Changeset 201542 in webkit
- Timestamp:
- May 31, 2016, 9:30:57 PM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 15 deleted
- 54 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSScriptRef.cpp
r201481 r201542 76 76 { 77 77 return !!JSC::parse<JSC::ProgramNode>( 78 vm, RuntimeFlags(),source, Identifier(), JSParserBuiltinMode::NotBuiltin,78 vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin, 79 79 JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, 80 80 error); -
trunk/Source/JavaScriptCore/CMakeLists.txt
r201532 r201542 609 609 runtime/ArrayIteratorPrototype.cpp 610 610 runtime/ArrayPrototype.cpp 611 runtime/AsyncFunctionConstructor.cpp612 runtime/AsyncFunctionPrototype.cpp613 611 runtime/BasicBlockLocation.cpp 614 612 runtime/BooleanConstructor.cpp … … 685 683 runtime/JSArrayBufferView.cpp 686 684 runtime/JSArrayIterator.cpp 687 runtime/JSAsyncFunction.cpp688 685 runtime/JSBoundFunction.cpp 689 686 runtime/JSBoundSlotBaseFunction.cpp … … 1214 1211 ${JAVASCRIPTCORE_DIR}/builtins/ArrayIteratorPrototype.js 1215 1212 ${JAVASCRIPTCORE_DIR}/builtins/ArrayPrototype.js 1216 ${JAVASCRIPTCORE_DIR}/builtins/AsyncFunctionPrototype.js1217 1213 ${JAVASCRIPTCORE_DIR}/builtins/DatePrototype.js 1218 1214 ${JAVASCRIPTCORE_DIR}/builtins/FunctionPrototype.js -
trunk/Source/JavaScriptCore/ChangeLog
r201532 r201542 1 2016-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 1 306 2016-05-31 Commit Queue <commit-queue@webkit.org> 2 307 -
trunk/Source/JavaScriptCore/DerivedSources.make
r201481 r201542 85 85 $(JavaScriptCore)/builtins/ArrayIteratorPrototype.js \ 86 86 $(JavaScriptCore)/builtins/ArrayPrototype.js \ 87 $(JavaScriptCore)/builtins/AsyncFunctionPrototype.js \88 87 $(JavaScriptCore)/builtins/DatePrototype.js \ 89 88 $(JavaScriptCore)/builtins/FunctionPrototype.js \ -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r201532 r201542 1180 1180 5370B4F51BF26202005C40FC /* AdaptiveInferredPropertyValueWatchpointBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5370B4F31BF25EA2005C40FC /* AdaptiveInferredPropertyValueWatchpointBase.cpp */; }; 1181 1181 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 */; };1188 1182 53917E7B1B7906FA000EBD33 /* JSGenericTypedArrayViewPrototypeFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 53917E7A1B7906E4000EBD33 /* JSGenericTypedArrayViewPrototypeFunctions.h */; }; 1189 1183 53F6BF6D1C3F060A00F41E5D /* InternalFunctionAllocationProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 53F6BF6C1C3F060A00F41E5D /* InternalFunctionAllocationProfile.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 3330 3324 53F6BF6C1C3F060A00F41E5D /* InternalFunctionAllocationProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InternalFunctionAllocationProfile.h; sourceTree = "<group>"; }; 3331 3325 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>"; };3339 3326 5D5D8AD00E0D0EBE00F9C692 /* libedit.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libedit.dylib; path = /usr/lib/libedit.dylib; sourceTree = "<absolute>"; }; 3340 3327 5DAFD6CB146B686300FBEFB4 /* JSC.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = JSC.xcconfig; sourceTree = "<group>"; }; … … 5534 5521 F692A84E0255597D01FF60F7 /* ArrayPrototype.h */, 5535 5522 0FB7F38A15ED8E3800F167B2 /* ArrayStorage.h */, 5536 5BD3A0611CAE325700F84BA3 /* AsyncFunctionConstructor.cpp */,5537 5BD3A0621CAE325700F84BA3 /* AsyncFunctionConstructor.h */,5538 5BD3A0631CAE325700F84BA3 /* AsyncFunctionPrototype.cpp */,5539 5BD3A0641CAE325700F84BA3 /* AsyncFunctionPrototype.h */,5540 5523 52678F8C1A031009006A306D /* BasicBlockLocation.cpp */, 5541 5524 52678F8D1A031009006A306D /* BasicBlockLocation.h */, … … 5714 5697 A7BDAEC417F4EA1400F6140C /* JSArrayIterator.cpp */, 5715 5698 A7BDAEC517F4EA1400F6140C /* JSArrayIterator.h */, 5716 5BD3A0651CAE325700F84BA3 /* JSAsyncFunction.cpp */,5717 5BD3A06D1CAE35BF00F84BA3 /* JSAsyncFunction.h */,5718 5699 86FA9E8F142BBB2D001773B7 /* JSBoundFunction.cpp */, 5719 5700 86FA9E90142BBB2E001773B7 /* JSBoundFunction.h */, … … 6869 6850 isa = PBXGroup; 6870 6851 children = ( 6871 5BF474881CB1C5DB0002BAD7 /* AsyncFunctionPrototype.js */,6872 6852 A7D801A01880D66E0026C39B /* ArrayPrototype.js */, 6873 6853 7CF9BC581B65D9A3009DB1EF /* ArrayConstructor.js */, … … 7187 7167 0F2B66DF17B6B5AB00A7AE3F /* DataView.h in Headers */, 7188 7168 BCD2034A0E17135E002C7E82 /* DateConstructor.h in Headers */, 7189 5BD3A0681CAE325700F84BA3 /* AsyncFunctionConstructor.h in Headers */,7190 7169 996B731A1BDA08D100331B84 /* DateConstructor.lut.h in Headers */, 7191 7170 41359CF30FDD89AD00206180 /* DateConversion.h in Headers */, … … 7545 7524 2AD8932B17E3868F00668276 /* HeapIterationScope.h in Headers */, 7546 7525 A5339EC91BB4B4600054F005 /* HeapObserver.h in Headers */, 7547 5BD3A06A1CAE325700F84BA3 /* AsyncFunctionPrototype.h in Headers */,7548 7526 2A6F462617E959CE00C45C98 /* HeapOperation.h in Headers */, 7549 7527 14F97447138C853E00DA1C67 /* HeapRootVisitor.h in Headers */, … … 8089 8067 14142E511B796ECE00F4BF4B /* UnlinkedFunctionExecutable.h in Headers */, 8090 8068 0F2E892C16D028AD009E4FD2 /* UnusedPointer.h in Headers */, 8091 5BD3A06E1CAE35BF00F84BA3 /* JSAsyncFunction.h in Headers */,8092 8069 99DA00B11BD5994E00F4575C /* UpdateContents.py in Headers */, 8093 8070 0F963B3813FC6FE90002D9B2 /* ValueProfile.h in Headers */, … … 8656 8633 0FEC858D1BDACDC70080FF74 /* AirTmp.cpp in Sources */, 8657 8634 0FEC85901BDACDC70080FF74 /* AirValidate.cpp in Sources */, 8658 5BD3A06B1CAE325700F84BA3 /* JSAsyncFunction.cpp in Sources */,8659 8635 147F39BD107EC37600427A48 /* ArgList.cpp in Sources */, 8660 8636 0F743BAA16B88249009F9277 /* ARM64Disassembler.cpp in Sources */, … … 9270 9246 0F13912916771C33009CCB07 /* ProfilerBytecodeSequence.cpp in Sources */, 9271 9247 0FF729AF166AD35C000F5BA3 /* ProfilerCompilation.cpp in Sources */, 9272 5BD3A0671CAE325700F84BA3 /* AsyncFunctionConstructor.cpp in Sources */,9273 9248 0FF729B0166AD35C000F5BA3 /* ProfilerCompilationKind.cpp in Sources */, 9274 9249 0FF729B1166AD35C000F5BA3 /* ProfilerCompiledBytecode.cpp in Sources */, … … 9405 9380 1ACF7377171CA6FB00C9BB1E /* Weak.cpp in Sources */, 9406 9381 14E84F9E14EE1ACC00D6D5D4 /* WeakBlock.cpp in Sources */, 9407 5BD3A0691CAE325700F84BA3 /* AsyncFunctionPrototype.cpp in Sources */,9408 9382 14F7256514EE265E00B1652B /* WeakHandleOwner.cpp in Sources */, 9409 9383 A7CA3AE317DA41AE006538AF /* WeakMapConstructor.cpp in Sources */, -
trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.cpp
r201481 r201542 80 80 RefPtr<SourceProvider> sourceOverride = isParsingDefaultConstructor ? source.provider() : nullptr; 81 81 std::unique_ptr<ProgramNode> program = parse<ProgramNode>( 82 &vm, RuntimeFlags(),source, Identifier(), builtinMode,82 &vm, source, Identifier(), builtinMode, 83 83 JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, error, 84 84 &positionBeforeLastNewline, constructorKind); -
trunk/Source/JavaScriptCore/bytecode/BytecodeList.json
r201532 r201542 100 100 { "name" : "op_new_generator_func", "length" : 4 }, 101 101 { "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 },104 102 { "name" : "op_set_function_name", "length" : 3 }, 105 103 { "name" : "op_call", "length" : 9 }, -
trunk/Source/JavaScriptCore/bytecode/BytecodeUseDef.h
r201532 r201542 150 150 case op_get_enumerable_length: 151 151 case op_new_func_exp: 152 case op_new_async_func_exp:153 152 case op_new_generator_func_exp: 154 153 case op_to_index_string: … … 181 180 case op_unsigned: 182 181 case op_new_func: 183 case op_new_async_func:184 182 case op_new_generator_func: 185 183 case op_get_parent_scope: … … 381 379 case op_new_func: 382 380 case op_new_func_exp: 383 case op_new_async_func:384 case op_new_async_func_exp:385 381 case op_new_generator_func: 386 382 case op_new_generator_func_exp: -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r201532 r201542 1413 1413 break; 1414 1414 } 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 }1431 1415 case op_new_func_exp: { 1432 1416 int r0 = (++it)->u.operand; … … 2334 2318 2335 2319 // 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) { 2337 2321 if (size_t count = mergePointBytecodeOffsets.size()) { 2338 2322 createRareDataIfNecessary(); -
trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h
r201481 r201542 119 119 bool usesEval() const { return m_usesEval; } 120 120 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; } 124 122 DerivedContextType derivedContextType() const { return static_cast<DerivedContextType>(m_derivedContextType); } 125 123 EvalContextType evalContextType() const { return static_cast<EvalContextType>(m_evalContextType); } -
trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp
r201523 r201542 49 49 50 50 static UnlinkedFunctionCodeBlock* generateUnlinkedFunctionCodeBlock( 51 VM& vm, const RuntimeFlags& runtimeFlags,UnlinkedFunctionExecutable* executable, const SourceCode& source,51 VM& vm, UnlinkedFunctionExecutable* executable, const SourceCode& source, 52 52 CodeSpecializationKind kind, DebuggerMode debuggerMode, 53 53 UnlinkedFunctionKind functionKind, ParserError& error, SourceParseMode parseMode) … … 57 57 ASSERT(isFunctionParseMode(executable->parseMode())); 58 58 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); 60 60 61 61 if (!function) { … … 92 92 , m_parameterCount(node->parameterCount()) 93 93 , m_features(0) 94 , m_sourceParseMode(node->parseMode())95 94 , m_isInStrictContext(node->isInStrictContext()) 96 95 , m_hasCapturedVariables(false) … … 101 100 , m_superBinding(static_cast<unsigned>(node->superBinding())) 102 101 , m_derivedContextType(static_cast<unsigned>(derivedContextType)) 102 , m_sourceParseMode(static_cast<unsigned>(node->parseMode())) 103 103 , m_name(node->ident()) 104 104 , m_ecmaName(node->ecmaName()) … … 113 113 ASSERT(m_superBinding == static_cast<unsigned>(node->superBinding())); 114 114 ASSERT(m_derivedContextType == static_cast<unsigned>(derivedContextType)); 115 ASSERT(m_sourceParseMode == static_cast<unsigned>(node->parseMode())); 115 116 116 117 m_parentScopeTDZVariables.swap(parentScopeTDZVariables); … … 175 176 VM& vm = exec.vm(); 176 177 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); 178 179 179 180 auto& globalObject = *exec.lexicalGlobalObject(); … … 190 191 191 192 UnlinkedFunctionCodeBlock* UnlinkedFunctionExecutable::unlinkedCodeBlockFor( 192 VM& vm, const RuntimeFlags& runtimeFlags, constSourceCode& source, CodeSpecializationKind specializationKind,193 VM& vm, const SourceCode& source, CodeSpecializationKind specializationKind, 193 194 DebuggerMode debuggerMode, ParserError& error, SourceParseMode parseMode) 194 195 { … … 205 206 206 207 UnlinkedFunctionCodeBlock* result = generateUnlinkedFunctionCodeBlock( 207 vm, runtimeFlags, this, source, specializationKind, debuggerMode,208 vm, this, source, specializationKind, debuggerMode, 208 209 isBuiltinFunction() ? UnlinkedBuiltinFunction : UnlinkedNormalFunction, 209 210 error, parseMode); -
trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h
r201523 r201542 51 51 class FunctionExecutable; 52 52 class ParserError; 53 class RuntimeFlags;54 53 class SourceCode; 55 54 class SourceProvider; … … 103 102 104 103 UnlinkedFunctionCodeBlock* unlinkedCodeBlockFor( 105 VM&, const RuntimeFlags&, constSourceCode&, CodeSpecializationKind, DebuggerMode,104 VM&, const SourceCode&, CodeSpecializationKind, DebuggerMode, 106 105 ParserError&, SourceParseMode); 107 106 … … 159 158 unsigned m_parameterCount; 160 159 CodeFeatures m_features; 161 SourceParseMode m_sourceParseMode;162 160 unsigned m_isInStrictContext : 1; 163 161 unsigned m_hasCapturedVariables : 1; … … 168 166 unsigned m_superBinding : 1; 169 167 unsigned m_derivedContextType: 2; 168 unsigned m_sourceParseMode : 4; // SourceParseMode 170 169 171 170 WriteBarrier<UnlinkedFunctionCodeBlock> m_unlinkedCodeBlockForCall; -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r201532 r201542 33 33 34 34 #include "BuiltinExecutables.h" 35 #include "BuiltinNames.h"36 35 #include "BytecodeLivenessAnalysis.h" 37 36 #include "Interpreter.h" … … 249 248 bool needsArguments = (functionNode->usesArguments() || codeBlock->usesEval() || (functionNode->usesArrowFunction() && !codeBlock->isArrowFunction() && isArgumentsUsedInInnerArrowFunction())); 250 249 251 // Generator and AsyncFunctionnever 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) 253 252 needsArguments = false; 254 253 255 if ( (parseMode == SourceParseMode::GeneratorWrapperFunctionMode || isAsyncFunctionWrapperParseMode(parseMode))&& needsArguments) {254 if (parseMode == SourceParseMode::GeneratorWrapperFunctionMode && needsArguments) { 256 255 // Generator does not provide "arguments". Instead, wrapping GeneratorFunction provides "arguments". 257 256 // This is because arguments of a generator should be evaluated before starting it. … … 300 299 301 300 // 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) { 303 302 m_generatorRegister = &m_parameters[1]; 304 303 … … 315 314 if (functionNameIsInScope(functionNode->ident(), functionNode->functionMode())) { 316 315 ASSERT(parseMode != SourceParseMode::GeneratorBodyMode); 317 ASSERT(parseMode != SourceParseMode::AsyncFunctionBodyMode);318 ASSERT(parseMode != SourceParseMode::AsyncArrowFunctionBodyMode);319 316 bool isDynamicScope = functionNameScopeIsDynamic(codeBlock->usesEval(), codeBlock->isStrictMode()); 320 317 bool isFunctionNameCaptured = captures(functionNode->ident().impl()); … … 541 538 } 542 539 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 } else562 emitMove(m_generatorRegister, &m_calleeRegister);563 break;564 }565 566 case SourceParseMode::AsyncFunctionBodyMode:567 case SourceParseMode::AsyncArrowFunctionBodyMode:568 540 case SourceParseMode::GeneratorBodyMode: { 569 541 // |this| is already filled correctly before here. … … 596 568 // We need load |super| & |this| for arrow function before initializeDefaultParameterValuesAndSetupFunctionScopeStack 597 569 // 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) { 601 571 if (functionNode->usesThis() || functionNode->usesSuperProperty()) 602 572 emitLoadThisFromArrowFunctionLexicalEnvironment(); … … 617 587 // because a function's default parameter ExpressionNodes will use temporary registers. 618 588 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 626 589 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 655 591 // If we don't have default parameter expression, then loading |this| inside an arrow function must be done 656 592 // after initializeDefaultParameterValuesAndSetupFunctionScopeStack() because that function sets up the 657 593 // 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) { 663 595 if (functionNode->usesThis() || functionNode->usesSuperProperty()) 664 596 emitLoadThisFromArrowFunctionLexicalEnvironment(); … … 2955 2887 opcodeID = op_new_generator_func_exp; 2956 2888 break; 2957 2958 case SourceParseMode::AsyncFunctionMode:2959 case SourceParseMode::AsyncMethodMode:2960 case SourceParseMode::AsyncArrowFunctionMode:2961 opcodeID = op_new_async_func_exp;2962 break;2963 2964 2889 default: 2965 2890 break; … … 2980 2905 RegisterID* BytecodeGenerator::emitNewArrowFunctionExpression(RegisterID* dst, ArrowFuncExprNode* func) 2981 2906 { 2982 ASSERT(func->metadata()->parseMode() == SourceParseMode::ArrowFunctionMode || func->metadata()->parseMode() == SourceParseMode::AsyncArrowFunctionMode);2907 ASSERT(func->metadata()->parseMode() == SourceParseMode::ArrowFunctionMode); 2983 2908 emitNewFunctionExpressionCommon(dst, func->metadata()); 2984 2909 return dst; … … 2990 2915 || func->metadata()->parseMode() == SourceParseMode::GetterMode 2991 2916 || func->metadata()->parseMode() == SourceParseMode::SetterMode 2992 || func->metadata()->parseMode() == SourceParseMode::MethodMode 2993 || func->metadata()->parseMode() == SourceParseMode::AsyncMethodMode); 2917 || func->metadata()->parseMode() == SourceParseMode::MethodMode); 2994 2918 emitNewFunctionExpressionCommon(dst, func->metadata()); 2995 2919 return dst; … … 3018 2942 if (function->parseMode() == SourceParseMode::GeneratorWrapperFunctionMode) 3019 2943 emitOpcode(op_new_generator_func); 3020 else if (function->parseMode() == SourceParseMode::AsyncFunctionMode)3021 emitOpcode(op_new_async_func);3022 2944 else 3023 2945 emitOpcode(op_new_func); … … 4308 4230 RegisterID* BytecodeGenerator::emitLoadArrowFunctionLexicalEnvironment(const Identifier& identifier) 4309 4231 { 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); 4311 4233 4312 4234 return emitResolveScope(nullptr, variable(identifier, ThisResolutionType::Scoped)); -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r201481 r201542 823 823 DerivedContextType newDerivedContextType = DerivedContextType::None; 824 824 825 if (metadata->parseMode() == SourceParseMode::ArrowFunctionMode || metadata->parseMode() == SourceParseMode::AsyncArrowFunctionMode) {825 if (metadata->parseMode() == SourceParseMode::ArrowFunctionMode) { 826 826 if (constructorKind() == ConstructorKind::Derived || isDerivedConstructorContext()) 827 827 newDerivedContextType = DerivedContextType::DerivedConstructorContext; … … 837 837 SourceParseMode parseMode = metadata->parseMode(); 838 838 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) 840 840 constructAbility = ConstructAbility::CannotConstruct; 841 841 else if (parseMode == SourceParseMode::MethodMode && metadata->constructorKind() == ConstructorKind::None) -
trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
r201481 r201542 3266 3266 } 3267 3267 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 arrows3283 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=1515453290 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:3329 3268 case SourceParseMode::GeneratorBodyMode: { 3330 3269 RefPtr<Label> generatorBodyLabel = generator.newLabel(); -
trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp
r201481 r201542 42 42 #include "JSLock.h" 43 43 #include "ParserError.h" 44 #include "RuntimeFlags.h"45 44 #include "ScriptDebugServer.h" 46 45 #include "SourceCode.h" … … 92 91 93 92 ParserError error; 94 checkSyntax(m_vm, RuntimeFlags(),JSC::makeSource(expression), error);93 checkSyntax(m_vm, JSC::makeSource(expression), error); 95 94 96 95 switch (error.syntaxErrorType()) { -
trunk/Source/JavaScriptCore/jit/JIT.cpp
r201532 r201542 284 284 DEFINE_OP(op_new_generator_func) 285 285 DEFINE_OP(op_new_generator_func_exp) 286 DEFINE_OP(op_new_async_func)287 DEFINE_OP(op_new_async_func_exp)288 286 DEFINE_OP(op_new_object) 289 287 DEFINE_OP(op_new_regexp) -
trunk/Source/JavaScriptCore/jit/JIT.h
r201487 r201542 554 554 void emit_op_new_generator_func(Instruction*); 555 555 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*);558 556 void emit_op_new_object(Instruction*); 559 557 void emit_op_new_regexp(Instruction*); -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r201487 r201542 972 972 if (opcodeID == op_new_func) 973 973 callOperation(operationNewFunction, dst, regT0, funcExec); 974 else if (opcodeID == op_new_async_func)975 callOperation(operationNewAsyncFunction, dst, regT0, funcExec);976 974 else { 977 975 ASSERT(opcodeID == op_new_generator_func); … … 986 984 987 985 void JIT::emit_op_new_generator_func(Instruction* currentInstruction) 988 {989 emitNewFuncCommon(currentInstruction);990 }991 992 void JIT::emit_op_new_async_func(Instruction* currentInstruction)993 986 { 994 987 emitNewFuncCommon(currentInstruction); … … 1016 1009 if (opcodeID == op_new_func_exp) 1017 1010 callOperation(operationNewFunction, dst, regT0, function); 1018 else if (opcodeID == op_new_async_func_exp)1019 callOperation(operationNewAsyncFunction, dst, regT0, function);1020 1011 else { 1021 1012 ASSERT(opcodeID == op_new_generator_func_exp); … … 1032 1023 1033 1024 void 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)1039 1025 { 1040 1026 emitNewFuncExprCommon(currentInstruction); -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r201481 r201542 47 47 #include "JITExceptions.h" 48 48 #include "JITToDFGDeferredCompilationCallback.h" 49 #include "JSAsyncFunction.h"50 49 #include "JSCInlines.h" 51 50 #include "JSGeneratorFunction.h" … … 1102 1101 { 1103 1102 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);1114 1103 } 1115 1104 -
trunk/Source/JavaScriptCore/jit/JITOperations.h
r201481 r201542 346 346 EncodedJSValue JIT_OPERATION operationNewFunction(ExecState*, JSScope*, JSCell*) WTF_INTERNAL; 347 347 EncodedJSValue 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;350 348 EncodedJSValue JIT_OPERATION operationNewGeneratorFunction(ExecState*, JSScope*, JSCell*) WTF_INTERNAL; 351 349 EncodedJSValue JIT_OPERATION operationNewGeneratorFunctionWithInvalidatedReallocationWatchpoint(ExecState*, JSScope*, JSCell*) WTF_INTERNAL; -
trunk/Source/JavaScriptCore/jsc.cpp
r201481 r201542 2098 2098 source = source + line; 2099 2099 source = source + '\n'; 2100 checkSyntax(globalObject->vm(), globalObject->runtimeFlags(),makeSource(source, interpreterName), error);2100 checkSyntax(globalObject->vm(), makeSource(source, interpreterName), error); 2101 2101 if (!line[0]) 2102 2102 break; … … 2161 2161 fprintf(stderr, " --dumpOptions Dumps all non-default JSC VM options before continuing\n"); 2162 2162 fprintf(stderr, " --<jsc VM option>=<value> Sets the specified JSC VM option\n"); 2163 2164 2163 fprintf(stderr, "\n"); 2165 2164 -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r201532 r201542 41 41 #include "JIT.h" 42 42 #include "JITExceptions.h" 43 #include "JSAsyncFunction.h"44 43 #include "JSLexicalEnvironment.h" 45 44 #include "JSCInlines.h" … … 1077 1076 } 1078 1077 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_TRACING1085 dataLogF("Creating async function!\n");1086 #endif1087 LLINT_RETURN(JSAsyncFunction::create(vm, codeBlock->functionDecl(pc[3].u.operand), scope));1088 }1089 1090 1078 LLINT_SLOW_PATH_DECL(slow_path_new_generator_func) 1091 1079 { … … 1119 1107 1120 1108 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));1132 1109 } 1133 1110 -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.h
r201487 r201542 101 101 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_func); 102 102 LLINT_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);105 103 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_generator_func); 106 104 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_generator_func_exp); -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r201487 r201542 1241 1241 1242 1242 1243 _llint_op_new_async_func:1244 traceExecution()1245 callSlowPath(_llint_slow_path_new_async_func)1246 dispatch(4)1247 1248 1249 1243 _llint_op_new_generator_func: 1250 1244 traceExecution() … … 1502 1496 dispatch(0) 1503 1497 1498 1504 1499 _llint_op_new_func_exp: 1505 1500 traceExecution() … … 1510 1505 traceExecution() 1511 1506 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)1517 1507 dispatch(4) 1518 1508 -
trunk/Source/JavaScriptCore/parser/ASTBuilder.h
r201481 r201542 381 381 } 382 382 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 394 383 ExpressionNode* createMethodDefinition(const JSTokenLocation& location, const ParserFunctionInfo<ASTBuilder>& functionInfo) 395 384 { -
trunk/Source/JavaScriptCore/parser/Keywords.table
r201481 r201542 8 8 9 9 # Keywords. 10 await AWAIT11 10 break BREAK 12 11 case CASE -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r201523 r201542 196 196 197 197 template <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)198 Parser<LexerType>::Parser(VM* vm, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, SourceParseMode parseMode, SuperBinding superBinding, ConstructorKind defaultConstructorKind, DerivedContextType derivedContextType, bool isEvalContext, EvalContextType evalContextType) 199 199 : m_vm(vm) 200 200 , m_source(&source) 201 201 , m_hasStackOverflow(false) 202 , m_runtimeFlags(runtimeFlags)203 202 , m_allowsIn(true) 204 203 , m_syntaxAlreadyValidated(source.provider()->isValid()) … … 254 253 SetForScope<FunctionParsePhase> functionParsePhasePoisoner(m_parserState.functionParsePhase, FunctionParsePhase::Body); 255 254 256 bool isArrowFunctionBodyExpression = parseMode == SourceParseMode::AsyncArrowFunctionBodyMode && !match(OPENBRACE);255 bool isArrowFunctionBodyExpression = false; 257 256 if (m_lexer->isReparsingFunction()) { 258 257 ParserFunctionInfo<ASTBuilder> functionInfo; 259 if ( SourceParseModeSet(SourceParseMode::GeneratorBodyMode).contains(parseMode) || isAsyncFunctionBodyParseMode(parseMode))258 if (parseMode == SourceParseMode::GeneratorBodyMode) 260 259 m_parameters = createGeneratorParameters(context); 261 260 else 262 261 m_parameters = parseFunctionParameters(context, parseMode, functionInfo); 263 262 264 if ( SourceParseModeSet(SourceParseMode::ArrowFunctionMode, SourceParseMode::AsyncArrowFunctionMode).contains(parseMode)&& !hasError()) {263 if (parseMode == SourceParseMode::ArrowFunctionMode && !hasError()) { 265 264 // The only way we could have an error wile reparsing is if we run out of stack space. 266 265 RELEASE_ASSERT(match(ARROWFUNCTION)); … … 279 278 // The only way we can error this early is if we reparse a function and we run out of stack space. 280 279 if (!hasError()) { 281 if (isAsyncFunctionWrapperParseMode(parseMode)) 282 sourceElements = parseAsyncFunctionSourceElements(context, parseMode, isArrowFunctionBodyExpression, CheckForStrictMode); 283 else if (isArrowFunctionBodyExpression) 280 if (isArrowFunctionBodyExpression) 284 281 sourceElements = parseArrowFunctionSingleExpressionBodySourceElements(context); 285 282 else if (isModuleParseMode(parseMode)) 286 283 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 } 291 290 } 292 291 … … 308 307 varDeclarations.markVariableAsCaptured(entry); 309 308 310 if ( SourceParseModeSet(SourceParseMode::GeneratorWrapperFunctionMode).contains(parseMode) || isAsyncFunctionWrapperParseMode(parseMode)) {309 if (parseMode == SourceParseMode::GeneratorWrapperFunctionMode) { 311 310 if (scope->usedVariablesContains(m_vm->propertyNames->arguments.impl())) 312 311 context.propagateArgumentsUse(); … … 353 352 bool Parser<LexerType>::isArrowFunctionParameters() 354 353 { 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(); 359 369 if (match(CLOSEPAREN)) { 360 370 next(); … … 368 378 unsigned parametersCount = 0; 369 379 isArrowFunction = parseFormalParameters(syntaxChecker, syntaxChecker.createFormalParameterList(), parametersCount) && consume(CLOSEPAREN) && match(ARROWFUNCTION); 370 380 371 381 popScope(fakeScope, syntaxChecker.NeedsFreeVariableInfo); 372 382 } 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; 386 388 } 387 389 … … 528 530 529 531 template <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 mode548 SourceParseMode innerParseMode = parseMode == SourceParseMode::AsyncArrowFunctionMode549 ? SourceParseMode::AsyncArrowFunctionBodyMode550 : 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 else558 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>575 532 template <class TreeBuilder> TreeStatement Parser<LexerType>::parseStatementListItem(TreeBuilder& context, const Identifier*& directive, unsigned* directiveLiteralLength) 576 533 { … … 581 538 TreeStatement result = 0; 582 539 bool shouldSetEndOffset = true; 583 584 540 switch (m_token.m_type) { 585 541 case CONSTTOKEN: … … 596 552 // But we would like to enter parseVariableDeclaration and raise an error under the context of parseVariableDeclaration 597 553 // 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)) 599 555 shouldParseVariableDeclaration = false; 600 556 restoreSavePoint(savePoint); … … 616 572 break; 617 573 case IDENT: 618 // FIXME: This branch contributes to a 1% octane code-load regression.619 // https://bugs.webkit.org/show_bug.cgi?id=158211620 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:635 574 case YIELD: { 636 575 // This is a convenient place to notice labeled statements … … 741 680 failIfTrue(match(LET) && (declarationType == DeclarationType::LetDeclaration || declarationType == DeclarationType::ConstDeclaration), 742 681 "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());744 682 JSTextPosition varStart = tokenStartPosition(); 745 683 JSTokenLocation varStartLocation(tokenLocation()); … … 1064 1002 failIfTrueIfStrict(isEvalOrArguments, "Cannot modify '", propertyName->impl(), "' in strict mode"); 1065 1003 } 1066 semanticFailIfTrue(isDisallowedIdentifierAwait(identifierToken), "Can't use 'await' as a ", destructuringKindToVariableKindName(kind), " ", disallowedIdentifierAwaitReason());1067 1004 innerPattern = createBindingPattern(context, kind, exportType, *propertyName, identifierToken, bindingContext, duplicateIdentifier); 1068 1005 } … … 1133 1070 } 1134 1071 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());1136 1072 pattern = createBindingPattern(context, kind, exportType, *m_token.m_data.ident, m_token, bindingContext, duplicateIdentifier); 1137 1073 next(); … … 1682 1618 break; 1683 1619 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"); 1686 1657 break; 1687 1658 } … … 1735 1706 return 0; 1736 1707 case IDENT: 1737 // FIXME: This branch contributes to a 1% octane code-load regression.1738 // https://bugs.webkit.org/show_bug.cgi?id=1582111739 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:1753 1708 case YIELD: { 1754 1709 bool allowFunctionDeclarationAsStatement = false; … … 1776 1731 1777 1732 template <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 back1784 // to hoisting behavior.1785 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=1558131786 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's1794 // in an if/else statement. If it's in an if/else statement, we will magically1795 // 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 else1814 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>1825 1733 template <class TreeBuilder> bool Parser<LexerType>::parseFormalParameters(TreeBuilder& context, TreeFormalParameterList list, unsigned& parameterCount) 1826 1734 { … … 1845 1753 next(); 1846 1754 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");1848 1755 declareRestOrNormalParameter(*m_token.m_data.ident, &duplicateParameter); 1849 1756 propagateError(); … … 1911 1818 case SourceParseMode::ArrowFunctionMode: 1912 1819 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";1921 1820 case SourceParseMode::ProgramMode: 1922 1821 case SourceParseMode::ModuleAnalyzeMode: … … 1931 1830 template <typename LexerType> template <class TreeBuilder, class FunctionInfoType> typename TreeBuilder::FormalParameterList Parser<LexerType>::parseFunctionParameters(TreeBuilder& context, SourceParseMode mode, FunctionInfoType& functionInfo) 1932 1831 { 1933 ASSERT(!(SourceParseModeSet(SourceParseMode::ProgramMode, SourceParseMode::ModuleAnalyzeMode, SourceParseMode::ModuleEvaluateMode).contains(mode)));1832 RELEASE_ASSERT(mode != SourceParseMode::ProgramMode && mode != SourceParseMode::ModuleAnalyzeMode && mode != SourceParseMode::ModuleEvaluateMode); 1934 1833 TreeFormalParameterList parameterList = context.createFormalParameterList(); 1935 1834 SetForScope<FunctionParsePhase> functionParsePhasePoisoner(m_parserState.functionParsePhase, FunctionParsePhase::Parameters); 1936 1835 1937 if ( SourceParseModeSet(SourceParseMode::ArrowFunctionMode, SourceParseMode::AsyncArrowFunctionMode).contains(mode)) {1938 if (!match SpecIdentifier() && !match(OPENPAREN)) {1836 if (mode == SourceParseMode::ArrowFunctionMode) { 1837 if (!match(IDENT) && !match(OPENPAREN)) { 1939 1838 semanticFailureDueToKeyword(stringForFunctionMode(mode), " name"); 1940 1839 failWithMessage("Expected an arrow function input parameter"); … … 2027 1926 RELEASE_ASSERT(isFunctionParseMode(mode)); 2028 1927 2029 bool isDisallowedAwaitFunctionName = isDisallowedIdentifierAwait(m_token); 2030 const char* isDisallowedAwaitFunctionNameReason = isDisallowedAwaitFunctionName ? disallowedIdentifierAwaitReason() : nullptr; 2031 1928 bool upperScopeIsGenerator = currentScope()->isGenerator(); 2032 1929 AutoPopScopeRef functionScope(this, pushScope()); 2033 1930 functionScope->setSourceParseMode(mode); … … 2068 1965 2069 1966 FunctionBodyType functionBodyType; 2070 if ( SourceParseModeSet(SourceParseMode::ArrowFunctionMode, SourceParseMode::AsyncArrowFunctionMode).contains(mode))1967 if (mode == SourceParseMode::ArrowFunctionMode) 2071 1968 functionBodyType = cachedInfo->isBodyArrowExpression ? ArrowFunctionBodyExpression : ArrowFunctionBodyBlock; 2072 1969 else … … 2111 2008 SyntaxChecker syntaxChecker(const_cast<VM*>(m_vm), m_lexer.get()); 2112 2009 2113 if ( SourceParseModeSet(SourceParseMode::ArrowFunctionMode, SourceParseMode::AsyncArrowFunctionMode).contains(mode)) {2010 if (mode == SourceParseMode::ArrowFunctionMode) { 2114 2011 startLocation = tokenLocation(); 2115 2012 functionInfo.startLine = tokenLine(); 2116 2013 startColumn = tokenColumn(); 2014 2117 2015 parametersStart = m_token.m_location.startOffset; 2118 2016 functionInfo.startOffset = parametersStart; … … 2121 2019 if (loadCachedFunction()) 2122 2020 return true; 2123 { 2124 SetForScope<bool> overrideAllowAwait(m_parserState.allowAwait, !isAsyncFunctionParseMode(mode)); 2125 parseFunctionParameters(syntaxChecker, mode, functionInfo); 2126 } 2127 2021 parseFunctionParameters(syntaxChecker, mode, functionInfo); 2128 2022 propagateError(); 2129 2023 … … 2155 2049 // function * BindingIdentifier[Yield]opt ( FormalParameters[Yield] ) { GeneratorBody } 2156 2050 // 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; 2161 2054 2162 2055 if (matchSpecIdentifier(upperScopeIsGenerator)) { 2163 bool allowsAwait = functionDefinitionType == FunctionDefinitionType::Declaration || mode != SourceParseMode::AsyncFunctionMode;2164 2056 functionInfo.name = m_token.m_data.ident; 2165 2057 m_parserState.lastFunctionName = functionInfo.name; 2166 if (allowsAwait)2167 semanticFailIfTrue(isDisallowedAwaitFunctionName, "Cannot declare function named 'await' ", isDisallowedAwaitFunctionNameReason);2168 else2169 semanticFailIfTrue(isDisallowedAwaitFunctionName, "Cannot declare async function named 'await'");2170 2171 2058 next(); 2172 2059 if (!nameIsInContainingScope) 2173 2060 failIfTrueIfStrict(functionScope->declareCallee(functionInfo.name) & DeclarationResult::InvalidStrictMode, "'", functionInfo.name->impl(), "' is not a valid ", stringForFunctionMode(mode), " name in strict mode"); 2174 2061 } 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"); 2179 2064 semanticFailureDueToKeyword(stringForFunctionMode(mode), " name"); 2180 2065 failDueToUnexpectedToken(); … … 2192 2077 if (loadCachedFunction()) 2193 2078 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(); 2199 2081 2200 2082 matchOrFail(OPENBRACE, "Expected an opening '{' at the start of a ", stringForFunctionMode(mode), " body"); … … 2240 2122 }; 2241 2123 2242 if ( UNLIKELY((SourceParseModeSet(SourceParseMode::GeneratorWrapperFunctionMode).contains(mode)) || isAsyncFunctionWrapperParseMode(mode))) {2124 if (mode == SourceParseMode::GeneratorWrapperFunctionMode) { 2243 2125 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); 2251 2127 generatorBodyScope->setConstructorKind(ConstructorKind::None); 2252 2128 generatorBodyScope->setExpectedSuperBinding(expectedSuperBinding); … … 2266 2142 context.setEndOffset(functionInfo.body, m_lexer->currentOffset()); 2267 2143 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); 2269 2145 semanticFailIfTrue(m_vm->propertyNames->arguments == *functionInfo.name, "'", functionInfo.name->impl(), "' is not a valid function name in strict mode"); 2270 2146 semanticFailIfTrue(m_vm->propertyNames->eval == *functionInfo.name, "'", functionInfo.name->impl(), "' is not a valid function name in strict mode"); … … 2353 2229 2354 2230 template <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>2384 2231 template <class TreeBuilder> TreeStatement Parser<LexerType>::parseClassDeclaration(TreeBuilder& context, ExportType exportType) 2385 2232 { … … 2479 2326 bool isSetter = false; 2480 2327 bool isGenerator = false; 2481 bool isAsyncMethod = false;2482 2328 if (consume(TIMES)) 2483 2329 isGenerator = true; 2484 2485 parseMethod:2486 2330 switch (m_token.m_type) { 2487 2331 namedKeyword: … … 2492 2336 break; 2493 2337 case IDENT: 2494 case AWAIT:2495 2338 ident = m_token.m_data.ident; 2496 2339 ASSERT(ident); 2497 2340 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))) { 2499 2342 isGetter = *ident == propertyNames.get; 2500 2343 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 }2507 2344 } 2508 2345 break; … … 2536 2373 bool isConstructor = !isStaticMethod && *ident == propertyNames.constructor; 2537 2374 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) { 2544 2376 isConstructor = false; 2545 2377 parseMode = SourceParseMode::GeneratorWrapperFunctionMode; … … 2624 2456 return context.createExprStatement(location, expression, start, m_lastTokenEndPosition.line); 2625 2457 } 2626 // FIXME: This branch contributes to a 1% octane code-load regression.2627 // https://bugs.webkit.org/show_bug.cgi?id=1582112628 if (UNLIKELY(match(AWAIT)))2629 semanticFailIfTrue(isDisallowedIdentifierAwait(m_token), "Can't use 'await' as a label ", disallowedIdentifierAwaitReason());2630 2458 const Identifier* ident = m_token.m_data.ident; 2631 2459 JSTextPosition end = tokenEndPosition(); … … 2824 2652 next(); 2825 2653 2826 failIfFalse(matchSpecIdentifier(), "Expected a variable name for the import declaration");2654 matchOrFail(IDENT, "Expected a variable name for the import declaration"); 2827 2655 localNameToken = m_token; 2828 2656 localName = m_token.m_data.ident; … … 2846 2674 if (matchContextualKeyword(m_vm->propertyNames->as)) { 2847 2675 next(); 2848 failIfFalse(matchSpecIdentifier(), "Expected a variable name for the import declaration");2676 matchOrFail(IDENT, "Expected a variable name for the import declaration"); 2849 2677 localNameToken = m_token; 2850 2678 localName = m_token.m_data.ident; … … 2857 2685 // ImportedDefaultBinding : 2858 2686 // ImportedBinding 2859 ASSERT(match SpecIdentifier());2687 ASSERT(match(IDENT)); 2860 2688 localNameToken = m_token; 2861 2689 localName = m_token.m_data.ident; … … 2866 2694 } 2867 2695 2868 semanticFailIfTrue(localNameToken.m_type == AWAIT, "Cannot use 'await' as an imported binding name");2869 2696 semanticFailIfTrue(localNameToken.m_type & KeywordTokenFlag, "Cannot use keyword as imported binding name"); 2870 2697 DeclarationResultMask declarationResult = declareVariable(localName, DeclarationType::ConstDeclaration, (specifierType == ImportSpecifierType::NamespaceImport) ? DeclarationImportType::ImportedNamespace : DeclarationImportType::Imported); … … 2897 2724 2898 2725 bool isFinishedParsingImport = false; 2899 if (match SpecIdentifier()) {2726 if (match(IDENT)) { 2900 2727 // ImportedDefaultBinding : 2901 2728 // ImportedBinding … … 3007 2834 bool isFunctionOrClassDeclaration = false; 3008 2835 const Identifier* localName = nullptr; 3009 bool isAsyncFunctionExport = false;3010 2836 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 else3018 restoreSavePoint(savePoint);3019 }3020 }3021 2837 3022 2838 bool startsWithFunction = match(FUNCTION); … … 3037 2853 DepthManager statementDepth(&m_statementDepth); 3038 2854 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); 3044 2856 } else { 3045 2857 ASSERT(match(CLASSTOKEN)); … … 3056 2868 // In the above example, *default* is the invisible variable to the users. 3057 2869 // We use the private symbol to represent the name of this variable. 3058 ExpressionErrorClassifier classifier(this);3059 2870 JSTokenLocation location(tokenLocation()); 3060 2871 JSTextPosition start = tokenStartPosition(); 3061 2872 TreeExpression expression = parseAssignmentExpression(context); 3062 3063 2873 failIfFalse(expression, "Cannot parse expression"); 3064 2874 … … 3163 2973 3164 2974 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 3174 2975 failWithMessage("Expected either a declaration or a variable statement"); 3175 2976 break; … … 3236 3037 3237 3038 failIfStackOverflow(); 3238 3239 if (match(YIELD) && !isYIELDMaskedAsIDENT(currentScope()->isGenerator()))3240 return parseYieldExpression(context);3241 3242 3039 JSTextPosition start = tokenStartPosition(); 3243 3040 JSTokenLocation location(tokenLocation()); … … 3246 3043 bool maybeAssignmentPattern = match(OPENBRACE) || match(OPENBRACKET); 3247 3044 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); 3252 3046 SavePoint savePoint = createSavePoint(); 3253 3047 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) { 3258 3049 usedVariablesSize = currentScope()->currentUsedVariablesSize(); 3259 3050 currentScope()->pushUsedVariableSet(); 3260 3051 } 3261 3052 3053 if (match(YIELD) && !isYIELDMaskedAsIDENT(currentScope()->isGenerator())) 3054 return parseYieldExpression(context); 3055 3262 3056 TreeExpression lhs = parseConditionalExpression(context); 3263 3057 3264 if ( maybeValidArrowFunctionStart && !match(EOFTOK)) {3058 if (isValidArrowFunctionStart && !match(EOFTOK)) { 3265 3059 bool isArrowFunctionToken = match(ARROWFUNCTION); 3266 3060 if (!lhs || isArrowFunctionToken) { 3267 3061 SavePointWithError errorRestorationSavePoint = createSavePointForError(); 3268 3062 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 }3276 3063 if (isArrowFunctionParameters()) { 3277 if (wasOpenParen || isAsyncArrow)3064 if (wasOpenParen) 3278 3065 currentScope()->revertToPreviousUsedVariables(usedVariablesSize); 3279 return parseArrowFunctionExpression(context , isAsyncArrow);3066 return parseArrowFunctionExpression(context); 3280 3067 } 3281 3068 restoreSavePointWithError(errorRestorationSavePoint); … … 3396 3183 return context.createYield(location); 3397 3184 } 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 YieldExpression3405 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;3415 3185 return context.createYield(location, argument, delegate, divotStart, argumentStart, lastTokenEndPosition()); 3416 3186 } … … 3502 3272 bool isGenerator = false; 3503 3273 bool isClassProperty = false; 3504 bool isAsyncMethod = false;3505 3274 if (consume(TIMES)) 3506 3275 isGenerator = true; 3507 3508 parseProperty:3509 3276 switch (m_token.m_type) { 3510 3277 namedProperty: 3511 3278 case IDENT: 3512 case AWAIT:3513 3279 wasIdent = true; 3514 3280 FALLTHROUGH; … … 3516 3282 const Identifier* ident = m_token.m_data.ident; 3517 3283 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))) 3519 3285 nextExpectIdentifier(LexerFlagsIgnoreReservedWords); 3520 3286 else 3521 3287 nextExpectIdentifier(LexerFlagsIgnoreReservedWords | TreeBuilder::DontBuildKeywords); 3522 3288 3523 if (!isGenerator && !isAsyncMethod &&match(COLON)) {3289 if (!isGenerator && match(COLON)) { 3524 3290 next(); 3525 3291 TreeExpression node = parseAssignmentExpressionOrPropagateErrorClass(context); … … 3530 3296 3531 3297 if (match(OPENPAREN)) { 3532 auto method = parsePropertyMethod(context, ident, isGenerator , isAsyncMethod);3298 auto method = parsePropertyMethod(context, ident, isGenerator); 3533 3299 propagateError(); 3534 3300 return context.createProperty(ident, method, PropertyNode::Constant, PropertyNode::KnownDirect, complete, SuperBinding::Needed, isClassProperty); 3535 3301 } 3536 3537 failIfTrue(isGenerator || isAsyncMethod, "Expected a parenthesis for argument list"); 3302 failIfTrue(isGenerator, "Expected a parenthesis for argument list"); 3538 3303 3539 3304 failIfFalse(wasIdent, "Expected an identifier as property name"); … … 3557 3322 else if (*ident == m_vm->propertyNames->set) 3558 3323 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 3564 3325 failWithMessage("Expected a ':' following the property name '", ident->impl(), "'"); 3565 3326 return parseGetterSetter(context, complete, type, getterOrSetterStartOffset, ConstructorKind::None, isClassProperty); … … 3572 3333 if (match(OPENPAREN)) { 3573 3334 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); 3575 3336 propagateError(); 3576 3337 return context.createProperty(&ident, method, PropertyNode::Constant, PropertyNode::Unknown, complete, SuperBinding::Needed, isClassProperty); 3577 3338 } 3578 failIfTrue(isGenerator || isAsyncMethod, "Expected a parenthesis for argument list");3339 failIfTrue(isGenerator, "Expected a parenthesis for argument list"); 3579 3340 3580 3341 consumeOrFail(COLON, "Expected ':' after property name"); … … 3591 3352 3592 3353 if (match(OPENPAREN)) { 3593 auto method = parsePropertyMethod(context, &m_vm->propertyNames->nullIdentifier, isGenerator , isAsyncMethod);3354 auto method = parsePropertyMethod(context, &m_vm->propertyNames->nullIdentifier, isGenerator); 3594 3355 propagateError(); 3595 3356 return context.createProperty(propertyName, method, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Computed), PropertyNode::KnownDirect, complete, SuperBinding::Needed, isClassProperty); 3596 3357 } 3597 failIfTrue(isGenerator || isAsyncMethod, "Expected a parenthesis for argument list");3358 failIfTrue(isGenerator, "Expected a parenthesis for argument list"); 3598 3359 3599 3360 consumeOrFail(COLON, "Expected ':' after property name"); … … 3610 3371 3611 3372 template <typename LexerType> 3612 template <class TreeBuilder> TreeExpression Parser<LexerType>::parsePropertyMethod(TreeBuilder& context, const Identifier* methodName, bool isGenerator , bool isAsync)3373 template <class TreeBuilder> TreeExpression Parser<LexerType>::parsePropertyMethod(TreeBuilder& context, const Identifier* methodName, bool isGenerator) 3613 3374 { 3614 3375 JSTokenLocation methodLocation(tokenLocation()); 3615 3376 unsigned methodStart = tokenStart(); 3616 3377 ParserFunctionInfo<TreeBuilder> methodInfo; 3617 SourceParseMode parseMode = isGenerator ? SourceParseMode::GeneratorWrapperFunctionMode : isAsync ? SourceParseMode::AsyncMethodMode :SourceParseMode::MethodMode;3378 SourceParseMode parseMode = isGenerator ? SourceParseMode::GeneratorWrapperFunctionMode : SourceParseMode::MethodMode; 3618 3379 failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, parseMode, false, ConstructorKind::None, SuperBinding::Needed, methodStart, methodInfo, FunctionDefinitionType::Method)), "Cannot parse this method"); 3619 3380 methodInfo.name = methodName; … … 3873 3634 3874 3635 template <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>3889 3636 template <class TreeBuilder> typename TreeBuilder::TemplateString Parser<LexerType>::parseTemplateString(TreeBuilder& context, bool isTemplateHead, typename LexerType::RawStringsBuildMode rawStringsBuildMode, bool& elementIsTail) 3890 3637 { … … 3976 3723 return context.createThisExpr(location); 3977 3724 } 3978 case AWAIT:3979 3725 case IDENT: { 3980 3726 identifierExpression: … … 3983 3729 JSTokenLocation location(tokenLocation()); 3984 3730 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; 3991 3733 currentScope()->useVariable(ident, m_vm->propertyNames->eval == *ident); 3992 3734 m_parserState.lastIdentifier = ident; … … 4164 3906 } 4165 3907 4166 bool baseIsAsyncKeyword = false;4167 3908 if (baseIsSuper) { 4168 3909 ScopeRef closestOrdinaryFunctionScope = closestParentOrdinaryFunctionNonLexicalScope(); … … 4182 3923 } 4183 3924 } 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) 4188 3926 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 // AsyncArrowFunction4193 forceClassifyExpressionError(ErrorIndicatesAsyncArrowFunction);4194 return 0;4195 }4196 baseIsAsyncKeyword = true;4197 }4198 }4199 3927 4200 3928 failIfFalse(base, "Cannot parse base expression"); 4201 4202 3929 while (true) { 4203 3930 location = tokenLocation(); … … 4232 3959 JSTextPosition expressionEnd = lastTokenEndPosition(); 4233 3960 TreeArguments arguments = parseArguments(context); 4234 if (UNLIKELY(baseIsAsyncKeyword && (!arguments || match(ARROWFUNCTION))))4235 forceClassifyExpressionError(ErrorIndicatesAsyncArrowFunction);4236 3961 failIfFalse(arguments, "Cannot parse call arguments"); 4237 3962 if (baseIsSuper) { … … 4292 4017 4293 4018 template <typename LexerType> 4294 template <class TreeBuilder> TreeExpression Parser<LexerType>::parseArrowFunctionExpression(TreeBuilder& context , bool isAsync)4019 template <class TreeBuilder> TreeExpression Parser<LexerType>::parseArrowFunctionExpression(TreeBuilder& context) 4295 4020 { 4296 4021 JSTokenLocation location; … … 4300 4025 ParserFunctionInfo<TreeBuilder> info; 4301 4026 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"); 4305 4028 4306 4029 return context.createArrowFunctionExpr(location, info); … … 4346 4069 bool requiresLExpr = false; 4347 4070 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=1582114351 if (UNLIKELY(match(AWAIT))) {4352 if (m_runtimeFlags.isAsyncAwaitEnabled() && currentFunctionScope()->isAsyncFunction())4353 return parseAwaitExpression(context);4354 }4355 4356 4071 while (isUnaryOp(m_token.m_type)) { 4357 4072 if (strictMode()) { … … 4534 4249 out.print("Invalid private name '", getToken(), "'"); 4535 4250 return; 4536 4251 4537 4252 case IDENT: 4538 4253 out.print("Unexpected identifier '", getToken(), "'"); -
trunk/Source/JavaScriptCore/parser/Parser.h
r201523 r201542 34 34 #include "ParserFunctionInfo.h" 35 35 #include "ParserTokens.h" 36 #include "RuntimeFlags.h"37 36 #include "SourceProvider.h" 38 37 #include "SourceProviderCache.h" … … 155 154 156 155 public: 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) 158 157 : m_vm(vm) 159 158 , m_shadowsArguments(false) … … 170 169 , m_isArrowFunction(isArrowFunction) 171 170 , m_isArrowFunctionBoundary(false) 172 , m_isAsyncFunction(isAsyncFunction)173 , m_isAsyncFunctionBoundary(false)174 171 , m_isLexicalScope(false) 175 172 , m_isFunctionBoundary(false) … … 259 256 { 260 257 switch (mode) { 261 case SourceParseMode::AsyncArrowFunctionBodyMode:262 setIsAsyncArrowFunctionBody();263 break;264 265 case SourceParseMode::AsyncFunctionBodyMode:266 setIsAsyncFunctionBody();267 break;268 269 258 case SourceParseMode::GeneratorBodyMode: 270 259 setIsGenerator(); … … 286 275 break; 287 276 288 case SourceParseMode::AsyncFunctionMode:289 case SourceParseMode::AsyncMethodMode:290 setIsAsyncFunction();291 break;292 293 case SourceParseMode::AsyncArrowFunctionMode:294 setIsAsyncArrowFunction();295 break;296 297 277 case SourceParseMode::ProgramMode: 298 278 break; … … 309 289 bool isGenerator() const { return m_isGenerator; } 310 290 bool isGeneratorBoundary() const { return m_isGeneratorBoundary; } 311 bool isAsyncFunction() const { return m_isAsyncFunction; }312 bool isAsyncFunctionBoundary() const { return m_isAsyncFunctionBoundary; }313 291 314 292 bool hasArguments() const { return m_hasArguments; } … … 338 316 ASSERT(m_moduleScopeData); 339 317 return *m_moduleScopeData; 340 }341 342 bool isModule() const343 {344 return !!m_moduleScopeData;345 318 } 346 319 … … 727 700 m_isArrowFunctionBoundary = false; 728 701 m_isArrowFunction = false; 729 m_isAsyncFunctionBoundary = false;730 m_isAsyncFunction = false;731 702 } 732 703 … … 750 721 m_isArrowFunctionBoundary = true; 751 722 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;780 723 } 781 724 … … 799 742 bool m_isArrowFunction; 800 743 bool m_isArrowFunctionBoundary; 801 bool m_isAsyncFunction;802 bool m_isAsyncFunctionBoundary;803 744 bool m_isLexicalScope; 804 745 bool m_isFunctionBoundary; … … 874 815 875 816 public: 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); 877 818 ~Parser(); 878 819 … … 963 904 964 905 enum ExpressionErrorClass { 965 ErrorIndicatesNothing = 0, 966 ErrorIndicatesPattern, 967 ErrorIndicatesAsyncArrowFunction 906 ErrorIndicatesNothing, 907 ErrorIndicatesPattern 968 908 }; 969 909 … … 989 929 } 990 930 991 void forceClassifyExpressionError(ExpressionErrorClass classification)992 {993 m_class = classification;994 }995 996 931 void reclassifyExpressionError(ExpressionErrorClass oldClassification, ExpressionErrorClass classification) 997 932 { … … 1003 938 void propagateExpressionErrorClass() 1004 939 { 1005 if (m_previous )940 if (m_previous && m_class != ErrorIndicatesNothing) 1006 941 m_previous->m_class = m_class; 1007 942 } 1008 943 1009 944 bool indicatesPossiblePattern() const { return m_class == ErrorIndicatesPattern; } 1010 bool indicatesPossibleAsyncArrowFunction() const { return m_class == ErrorIndicatesAsyncArrowFunction; } 945 1011 946 private: 1012 947 ExpressionErrorClass m_class; … … 1019 954 if (m_expressionErrorClassifier) 1020 955 m_expressionErrorClassifier->classifyExpressionError(classification); 1021 }1022 1023 ALWAYS_INLINE void forceClassifyExpressionError(ExpressionErrorClass classification)1024 {1025 if (m_expressionErrorClassifier)1026 m_expressionErrorClassifier->forceClassifyExpressionError(classification);1027 956 } 1028 957 … … 1048 977 } 1049 978 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 1063 979 ALWAYS_INLINE AssignmentContext assignmentContextFromDeclarationType(DeclarationType type) 1064 980 { … … 1073 989 ALWAYS_INLINE bool isEvalOrArguments(const Identifier* ident) { return isEvalOrArgumentsIdentifier(m_vm, ident); } 1074 990 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 1081 991 ScopeRef currentScope() 1082 992 { … … 1123 1033 unsigned i = m_scopeStack.size() - 1; 1124 1034 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())) 1126 1036 i--; 1127 1037 // When reaching the top level scope (it can be non ordinary function scope), we return it. … … 1135 1045 bool isGenerator = false; 1136 1046 bool isArrowFunction = false; 1137 bool isAsyncFunction = false;1138 1047 if (!m_scopeStack.isEmpty()) { 1139 1048 isStrict = m_scopeStack.last().strictMode(); … … 1141 1050 isGenerator = m_scopeStack.last().isGenerator(); 1142 1051 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); 1146 1054 return currentScope(); 1147 1055 } … … 1155 1063 if (m_scopeStack.last().isArrowFunction()) 1156 1064 m_scopeStack.last().setInnerArrowFunctionUsesEvalAndUseArgumentsIfNeeded(); 1157 1065 1158 1066 if (!(m_scopeStack.last().isFunctionBoundary() && !m_scopeStack.last().isArrowFunctionBoundary())) 1159 1067 m_scopeStack[m_scopeStack.size() - 2].mergeInnerArrowFunctionFeatures(m_scopeStack.last().innerArrowFunctionFeatures()); … … 1452 1360 ALWAYS_INLINE bool matchSpecIdentifier(bool inGenerator) 1453 1361 { 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 1458 1365 ALWAYS_INLINE bool matchSpecIdentifier() 1459 1366 { 1460 return match (IDENT) || match(AWAIT) || isLETMaskedAsIDENT() || isYIELDMaskedAsIDENT(currentScope()->isGenerator());1367 return matchSpecIdentifier(currentScope()->isGenerator()); 1461 1368 } 1462 1369 1463 1370 template <class TreeBuilder> TreeSourceElements parseSourceElements(TreeBuilder&, SourceElementsMode); 1464 1371 template <class TreeBuilder> TreeSourceElements parseGeneratorFunctionSourceElements(TreeBuilder&, SourceElementsMode); 1465 template <class TreeBuilder> TreeSourceElements parseAsyncFunctionSourceElements(TreeBuilder&, SourceParseMode, bool isArrowFunctionBodyExpression, SourceElementsMode);1466 1372 template <class TreeBuilder> TreeStatement parseStatementListItem(TreeBuilder&, const Identifier*& directive, unsigned* directiveLiteralLength); 1467 1373 template <class TreeBuilder> TreeStatement parseStatement(TreeBuilder&, const Identifier*& directive, unsigned* directiveLiteralLength = 0); … … 1469 1375 template <class TreeBuilder> TreeStatement parseClassDeclaration(TreeBuilder&, ExportType = ExportType::NotExported); 1470 1376 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);1473 1377 template <class TreeBuilder> TreeStatement parseVariableDeclaration(TreeBuilder&, DeclarationType, ExportType = ExportType::NotExported); 1474 1378 template <class TreeBuilder> TreeStatement parseDoWhileStatement(TreeBuilder&); … … 1497 1401 template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseBinaryExpression(TreeBuilder&); 1498 1402 template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseUnaryExpression(TreeBuilder&); 1499 template <class TreeBuilder> NEVER_INLINE TreeExpression parseAwaitExpression(TreeBuilder&);1500 1403 template <class TreeBuilder> TreeExpression parseMemberExpression(TreeBuilder&); 1501 1404 template <class TreeBuilder> ALWAYS_INLINE TreeExpression parsePrimaryExpression(TreeBuilder&); … … 1504 1407 template <class TreeBuilder> NEVER_INLINE TreeExpression parseStrictObjectLiteral(TreeBuilder&); 1505 1408 template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseFunctionExpression(TreeBuilder&); 1506 template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseAsyncFunctionExpression(TreeBuilder&);1507 1409 template <class TreeBuilder> ALWAYS_INLINE TreeArguments parseArguments(TreeBuilder&); 1508 1410 template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseArgument(TreeBuilder&, ArgumentType&); 1509 1411 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); 1511 1413 template <class TreeBuilder> TreeProperty parseGetterSetter(TreeBuilder&, bool strict, PropertyNode::Type, unsigned getterOrSetterStartOffset, ConstructorKind, bool isClassProperty); 1512 1414 template <class TreeBuilder> ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&, SyntaxChecker&, const JSTokenLocation&, int, int functionKeywordStart, int functionNameStart, int parametersStart, ConstructorKind, SuperBinding, FunctionBodyType, unsigned, SourceParseMode); … … 1515 1417 template <class TreeBuilder> TreeExpression parseVariableDeclarationList(TreeBuilder&, int& declarations, TreeDestructuringPattern& lastPattern, TreeExpression& lastInitializer, JSTextPosition& identStart, JSTextPosition& initStart, JSTextPosition& initEnd, VarDeclarationListContext, DeclarationType, ExportType, bool& forLoopConstDoesNotHaveInitializer); 1516 1418 template <class TreeBuilder> TreeSourceElements parseArrowFunctionSingleExpressionBodySourceElements(TreeBuilder&); 1517 template <class TreeBuilder> TreeExpression parseArrowFunctionExpression(TreeBuilder& , bool isAsync);1419 template <class TreeBuilder> TreeExpression parseArrowFunctionExpression(TreeBuilder&); 1518 1420 template <class TreeBuilder> NEVER_INLINE TreeDestructuringPattern createBindingPattern(TreeBuilder&, DestructuringKind, ExportType, const Identifier&, JSToken, AssignmentContext, const Identifier** duplicateIdentifier); 1519 1421 template <class TreeBuilder> NEVER_INLINE TreeDestructuringPattern createAssignmentElement(TreeBuilder&, TreeExpression&, const JSTextPosition&, const JSTextPosition&); … … 1573 1475 } 1574 1476 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 1590 1477 enum class FunctionParsePhase { Parameters, Body }; 1591 1478 struct ParserState { … … 1596 1483 const Identifier* lastIdentifier { nullptr }; 1597 1484 const Identifier* lastFunctionName { nullptr }; 1598 bool allowAwait { true };1599 1485 }; 1600 1486 … … 1707 1593 String m_errorMessage; 1708 1594 JSToken m_token; 1709 RuntimeFlags m_runtimeFlags;1710 1595 bool m_allowsIn; 1711 1596 JSTextPosition m_lastTokenEndPosition; … … 1840 1725 template <class ParsedNode> 1841 1726 std::unique_ptr<ParsedNode> parse( 1842 VM* vm, RuntimeFlags runtimeFlags,const SourceCode& source,1727 VM* vm, const SourceCode& source, 1843 1728 const Identifier& name, JSParserBuiltinMode builtinMode, 1844 1729 JSParserStrictMode strictMode, SourceParseMode parseMode, SuperBinding superBinding, … … 1848 1733 ASSERT(!source.provider()->source().isNull()); 1849 1734 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); 1851 1736 std::unique_ptr<ParsedNode> result = parser.parse<ParsedNode>(error, name, parseMode); 1852 1737 if (positionBeforeLastNewline) … … 1859 1744 } 1860 1745 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); 1862 1747 std::unique_ptr<ParsedNode> result = parser.parse<ParsedNode>(error, name, parseMode); 1863 1748 if (positionBeforeLastNewline) -
trunk/Source/JavaScriptCore/parser/ParserModes.h
r201523 r201542 28 28 #define ParserModes_h 29 29 30 #include "ConstructAbility.h"31 30 #include "Identifier.h" 32 31 … … 44 43 enum class FunctionMode { FunctionExpression, FunctionDeclaration, MethodDefinition }; 45 44 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, 45 enum class SourceParseMode : uint8_t { 46 NormalFunctionMode, 47 GeneratorBodyMode, 48 GeneratorWrapperFunctionMode, 49 GetterMode, 50 SetterMode, 51 MethodMode, 52 ArrowFunctionMode, 53 ProgramMode, 54 ModuleAnalyzeMode, 55 ModuleEvaluateMode 64 56 }; 65 57 66 class SourceParseModeSet { 67 public: 68 template<typename... Modes> 69 SourceParseModeSet(Modes... args) 70 : m_mask(mergeSourceParseModes(args...)) 71 { 58 inline 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; 72 74 } 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; 109 77 } 110 78 111 ALWAYS_INLINE bool isAsyncFunctionParseMode(SourceParseMode parseMode)79 inline bool isModuleParseMode(SourceParseMode parseMode) 112 80 { 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; 119 98 } 120 99 121 ALWAYS_INLINE bool isAsyncArrowFunctionParseMode(SourceParseMode parseMode)100 inline bool isProgramParseMode(SourceParseMode parseMode) 122 101 { 123 return SourceParseModeSet( 124 SourceParseMode::AsyncArrowFunctionMode, 125 SourceParseMode::AsyncArrowFunctionBodyMode).contains(parseMode); 126 } 102 switch (parseMode) { 103 case SourceParseMode::ProgramMode: 104 return true; 127 105 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; 160 119 } 161 120 -
trunk/Source/JavaScriptCore/parser/ParserTokens.h
r201523 r201542 83 83 EXTENDS, 84 84 SUPER, 85 AWAIT,86 85 OPENBRACE = 0, 87 86 CLOSEBRACE, -
trunk/Source/JavaScriptCore/parser/SourceCodeKey.h
r201481 r201542 29 29 30 30 #include "ParserModes.h" 31 #include "RuntimeFlags.h"32 31 #include "SourceCode.h" 33 32 #include <wtf/HashTraits.h> … … 68 67 } 69 68 70 SourceCodeKey(const SourceCode& sourceCode, const RuntimeFlags& runtimeFlags, constString& 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) 71 70 : m_sourceCode(sourceCode) 72 71 , m_name(name) 73 72 , m_flags(codeType, builtinMode, strictMode, derivedContextType, evalContextType, isArrowFunctionContext) 74 73 , m_hash(sourceCode.hash()) 75 , m_runtimeFlags(runtimeFlags)76 74 { 77 75 } … … 94 92 StringView string() const { return m_sourceCode.view(); } 95 93 96 const RuntimeFlags& runtimeFlags() const { return m_runtimeFlags; }97 98 94 bool operator==(const SourceCodeKey& other) const 99 95 { … … 102 98 && m_flags == other.m_flags 103 99 && m_name == other.m_name 104 && string() == other.string() 105 && m_runtimeFlags == other.runtimeFlags(); 100 && string() == other.string(); 106 101 } 107 102 … … 122 117 SourceCodeFlags m_flags; 123 118 unsigned m_hash; 124 RuntimeFlags m_runtimeFlags;125 119 }; 126 120 -
trunk/Source/JavaScriptCore/parser/SyntaxChecker.h
r201481 r201542 185 185 ClassExpression createClassExpr(const JSTokenLocation&, const ParserClassInfo<SyntaxChecker>&, VariableEnvironment&, ExpressionType, ExpressionType, PropertyList, PropertyList) { return ClassExpr; } 186 186 ExpressionType createFunctionExpr(const JSTokenLocation&, const ParserFunctionInfo<SyntaxChecker>&) { return FunctionExpr; } 187 ExpressionType createAsyncFunctionBody(const JSTokenLocation&, const ParserFunctionInfo<SyntaxChecker>&) { return FunctionExpr; }188 187 int createFunctionMetadata(const JSTokenLocation&, const JSTokenLocation&, int, int, bool, int, int, int, ConstructorKind, SuperBinding, unsigned, SourceParseMode, bool, InnerArrowFunctionCodeFeatures = NoInnerArrowFunctionFeatures) { return FunctionBodyResult; } 189 188 ExpressionType createArrowFunctionExpr(const JSTokenLocation&, const ParserFunctionInfo<SyntaxChecker>&) { return FunctionExpr; } -
trunk/Source/JavaScriptCore/runtime/CodeCache.cpp
r201481 r201542 82 82 83 83 template <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)84 UnlinkedCodeBlockType* CodeCache::getGlobalCodeBlock(VM& vm, ExecutableType* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ParserError& error, EvalContextType evalContextType, const VariableEnvironment* variablesUnderTDZ) 85 85 { 86 86 DerivedContextType derivedContextType = executable->derivedContextType(); 87 87 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); 89 89 SourceCodeValue* cache = m_sourceCode.findCacheAndUpdateAge(key); 90 90 // FIXME: We should do something smart for TDZ instead of just disabling caching. … … 105 105 typedef typename CacheTypes<UnlinkedCodeBlockType>::RootNode RootNode; 106 106 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); 108 108 if (!rootNode) 109 109 return nullptr; … … 134 134 } 135 135 136 UnlinkedProgramCodeBlock* CodeCache::getProgramCodeBlock(VM& vm, const RuntimeFlags& runtimeFlags,ProgramExecutable* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ParserError& error)136 UnlinkedProgramCodeBlock* CodeCache::getProgramCodeBlock(VM& vm, ProgramExecutable* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ParserError& error) 137 137 { 138 138 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 142 UnlinkedEvalCodeBlock* 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 147 UnlinkedModuleProgramCodeBlock* CodeCache::getModuleProgramCodeBlock(VM& vm, ModuleProgramExecutable* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, DebuggerMode debuggerMode, ParserError& error) 148 148 { 149 149 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); 151 151 } 152 152 153 153 // 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, constIdentifier& name, const SourceCode& source, ParserError& error)154 UnlinkedFunctionExecutable* CodeCache::getFunctionExecutableFromGlobalCode(VM& vm, const Identifier& name, const SourceCode& source, ParserError& error) 155 155 { 156 156 bool isArrowFunctionContext = false; 157 157 SourceCodeKey key( 158 source, runtimeFlags,name.string(), SourceCodeType::FunctionType,158 source, name.string(), SourceCodeType::FunctionType, 159 159 JSParserBuiltinMode::NotBuiltin, 160 160 JSParserStrictMode::NotStrict, … … 172 172 JSTextPosition positionBeforeLastNewline; 173 173 std::unique_ptr<ProgramNode> program = parse<ProgramNode>( 174 &vm, runtimeFlags,source, Identifier(), JSParserBuiltinMode::NotBuiltin,174 &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin, 175 175 JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, 176 176 error, &positionBeforeLastNewline); … … 202 202 // The Function constructor only has access to global variables, so no variables will be under TDZ. 203 203 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); 207 205 208 206 functionExecutable->setSourceURLDirective(source.provider()->sourceURL()); -
trunk/Source/JavaScriptCore/runtime/CodeCache.h
r201481 r201542 50 50 class UnlinkedProgramCodeBlock; 51 51 class VM; 52 class RuntimeFlags;53 52 class VariableEnvironment; 54 53 … … 189 188 ~CodeCache(); 190 189 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&, constIdentifier&, 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&); 195 194 196 195 void clear() … … 201 200 private: 202 201 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*); 204 203 205 204 CodeCacheMap m_sourceCode; -
trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h
r201481 r201542 107 107 macro(as) \ 108 108 macro(assign) \ 109 macro(async) \110 109 macro(back) \ 111 110 macro(bind) \ … … 268 267 269 268 #define JSC_COMMON_IDENTIFIERS_EACH_KEYWORD(macro) \ 270 macro(await) \271 269 macro(break) \ 272 270 macro(case) \ -
trunk/Source/JavaScriptCore/runtime/Completion.cpp
r201481 r201542 40 40 #include "ModuleLoaderObject.h" 41 41 #include "Parser.h" 42 #include "RuntimeFlags.h"43 42 #include "ScriptProfilingScope.h" 44 43 #include <wtf/WTFThreadData.h> … … 62 61 } 63 62 64 bool checkSyntax(VM& vm, const RuntimeFlags& runtimeFlags, constSourceCode& source, ParserError& error)63 bool checkSyntax(VM& vm, const SourceCode& source, ParserError& error) 65 64 { 66 65 JSLockHolder lock(vm); 67 66 RELEASE_ASSERT(vm.atomicStringTable() == wtfThreadData().atomicStringTable()); 68 67 return !!parse<ProgramNode>( 69 &vm, runtimeFlags,source, Identifier(), JSParserBuiltinMode::NotBuiltin,68 &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin, 70 69 JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, error); 71 70 } … … 77 76 RELEASE_ASSERT(vm.atomicStringTable() == wtfThreadData().atomicStringTable()); 78 77 std::unique_ptr<ModuleProgramNode> moduleProgramNode = parse<ModuleProgramNode>( 79 &vm, exec->lexicalGlobalObject()->runtimeFlags(),source, Identifier(), JSParserBuiltinMode::NotBuiltin,78 &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin, 80 79 JSParserStrictMode::Strict, SourceParseMode::ModuleAnalyzeMode, SuperBinding::NotNeeded, error); 81 80 if (!moduleProgramNode) -
trunk/Source/JavaScriptCore/runtime/Completion.h
r201481 r201542 34 34 class JSObject; 35 35 class ParserError; 36 class RuntimeFlags;37 36 class SourceCode; 38 37 class VM; 39 38 class JSInternalPromise; 40 39 41 JS_EXPORT_PRIVATE bool checkSyntax(VM&, const RuntimeFlags&, constSourceCode&, ParserError&);40 JS_EXPORT_PRIVATE bool checkSyntax(VM&, const SourceCode&, ParserError&); 42 41 JS_EXPORT_PRIVATE bool checkSyntax(ExecState*, const SourceCode&, JSValue* exception = 0); 43 42 JS_EXPORT_PRIVATE bool checkModuleSyntax(ExecState*, const SourceCode&, ParserError&); -
trunk/Source/JavaScriptCore/runtime/Executable.cpp
r201481 r201542 315 315 UnlinkedFunctionCodeBlock* unlinkedCodeBlock = 316 316 executable->m_unlinkedExecutable->unlinkedCodeBlockFor( 317 *vm, globalObject->runtimeFlags(),executable->m_source, kind, debuggerMode, error,317 *vm, executable->m_source, kind, debuggerMode, error, 318 318 executable->parseMode()); 319 319 recordParse( … … 570 570 JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject(); 571 571 std::unique_ptr<ProgramNode> programNode = parse<ProgramNode>( 572 vm, lexicalGlobalObject->runtimeFlags(),m_source, Identifier(), JSParserBuiltinMode::NotBuiltin,572 vm, m_source, Identifier(), JSParserBuiltinMode::NotBuiltin, 573 573 JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, error); 574 574 if (programNode) -
trunk/Source/JavaScriptCore/runtime/Executable.h
r201481 r201542 653 653 bool isClass() const { return !classSource().isNull(); } 654 654 bool isArrowFunction() const { return parseMode() == SourceParseMode::ArrowFunctionMode; } 655 bool isAsyncFunction() const { return isAsyncFunctionParseMode(parseMode()); }656 655 bool isGetter() const { return parseMode() == SourceParseMode::GetterMode; } 657 656 bool isSetter() const { return parseMode() == SourceParseMode::SetterMode; } -
trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp
r201481 r201542 96 96 String program; 97 97 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}}"); 99 99 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}}"); 101 101 else { 102 102 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('*'); 110 106 builder.append(functionName.string()); 111 107 builder.append('('); -
trunk/Source/JavaScriptCore/runtime/FunctionConstructor.h
r201481 r201542 60 60 Function, 61 61 Generator, 62 Async63 62 }; 64 63 -
trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
r201481 r201542 352 352 return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); 353 353 354 if (propertyName == exec->propertyNames().prototype && !thisObject->jsExecutable()->isArrowFunction() && !thisObject->jsExecutable()->isAsyncFunction()) {354 if (propertyName == exec->propertyNames().prototype && !thisObject->jsExecutable()->isArrowFunction()) { 355 355 VM& vm = exec->vm(); 356 356 unsigned attributes; -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r201481 r201542 34 34 #include "ArrayIteratorPrototype.h" 35 35 #include "ArrayPrototype.h" 36 #include "AsyncFunctionConstructor.h"37 #include "AsyncFunctionPrototype.h"38 36 #include "BooleanConstructor.h" 39 37 #include "BooleanPrototype.h" … … 67 65 #include "JSArrayBufferPrototype.h" 68 66 #include "JSArrayIterator.h" 69 #include "JSAsyncFunction.h"70 67 #include "JSBoundFunction.h" 71 68 #include "JSBoundSlotBaseFunction.h" … … 616 613 }); 617 614 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 623 615 m_generatorFunctionPrototype.set(vm, this, GeneratorFunctionPrototype::create(vm, GeneratorFunctionPrototype::createStructure(vm, this, m_functionPrototype.get()))); 624 616 GeneratorFunctionConstructor* generatorFunctionConstructor = GeneratorFunctionConstructor::create(vm, GeneratorFunctionConstructor::createStructure(vm, this, functionConstructor), m_generatorFunctionPrototype.get()); … … 773 765 GlobalPropertyInfo(vm.propertyNames->builtinNames().thisTimeValuePrivateName(), privateFuncThisTimeValue, DontEnum | DontDelete | ReadOnly), 774 766 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 777 767 #if ENABLE(INTL) 778 768 GlobalPropertyInfo(vm.propertyNames->builtinNames().CollatorPrivateName(), intl->getDirect(vm, vm.propertyNames->Collator), DontEnum | DontDelete | ReadOnly), … … 1227 1217 DebuggerMode debuggerMode = hasInteractiveDebugger() ? DebuggerOn : DebuggerOff; 1228 1218 UnlinkedProgramCodeBlock* unlinkedCodeBlock = vm().codeCache()->getProgramCodeBlock( 1229 vm(), runtimeFlags(),executable, executable->source(), JSParserBuiltinMode::NotBuiltin, strictMode,1219 vm(), executable, executable->source(), JSParserBuiltinMode::NotBuiltin, strictMode, 1230 1220 debuggerMode, error); 1231 1221 … … 1249 1239 1250 1240 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); 1252 1242 1253 1243 if (hasDebugger()) … … 1267 1257 DebuggerMode debuggerMode = hasInteractiveDebugger() ? DebuggerOn : DebuggerOff; 1268 1258 UnlinkedModuleProgramCodeBlock* unlinkedCodeBlock = vm().codeCache()->getModuleProgramCodeBlock( 1269 vm(), runtimeFlags(),executable, executable->source(), JSParserBuiltinMode::NotBuiltin, debuggerMode, error);1259 vm(), executable, executable->source(), JSParserBuiltinMode::NotBuiltin, debuggerMode, error); 1270 1260 1271 1261 if (hasDebugger()) -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r201481 r201542 57 57 58 58 class ArrayPrototype; 59 class AsyncFunctionPrototype;60 59 class BooleanPrototype; 61 60 class ConsoleClient; … … 258 257 WriteBarrier<FunctionPrototype> m_functionPrototype; 259 258 WriteBarrier<ArrayPrototype> m_arrayPrototype; 260 WriteBarrier<AsyncFunctionPrototype> m_asyncFunctionPrototype;261 259 WriteBarrier<RegExpPrototype> m_regExpPrototype; 262 260 WriteBarrier<IteratorPrototype> m_iteratorPrototype; … … 300 298 WriteBarrier<Structure> m_privateNameStructure; 301 299 WriteBarrier<Structure> m_regExpStructure; 302 WriteBarrier<Structure> m_asyncFunctionStructure;303 300 WriteBarrier<Structure> m_generatorFunctionStructure; 304 301 WriteBarrier<Structure> m_dollarVMStructure; … … 505 502 FunctionPrototype* functionPrototype() const { return m_functionPrototype.get(); } 506 503 ArrayPrototype* arrayPrototype() const { return m_arrayPrototype.get(); } 507 AsyncFunctionPrototype* asyncFunctionPrototype() const { return m_asyncFunctionPrototype.get(); }508 504 JSObject* booleanPrototype() const { return m_booleanObjectStructure.prototype(this); } 509 505 StringPrototype* stringPrototype() const { return m_stringPrototype.get(); } … … 574 570 Structure* mapStructure() const { return m_mapStructure.get(); } 575 571 Structure* regExpStructure() const { return m_regExpStructure.get(); } 576 Structure* asyncFunctionStructure() const { return m_asyncFunctionStructure.get(); }577 572 Structure* generatorFunctionStructure() const { return m_generatorFunctionStructure.get(); } 578 573 Structure* setStructure() const { return m_setStructure.get(this); } -
trunk/Source/JavaScriptCore/runtime/ModuleLoaderObject.cpp
r201481 r201542 276 276 ParserError error; 277 277 std::unique_ptr<ModuleProgramNode> moduleProgramNode = parse<ModuleProgramNode>( 278 &vm, exec->vmEntryGlobalObject()->runtimeFlags(),sourceCode, Identifier(), JSParserBuiltinMode::NotBuiltin,278 &vm, sourceCode, Identifier(), JSParserBuiltinMode::NotBuiltin, 279 279 JSParserStrictMode::Strict, SourceParseMode::ModuleAnalyzeMode, SuperBinding::NotNeeded, error); 280 280 -
trunk/Source/JavaScriptCore/runtime/RuntimeFlags.h
r201481 r201542 31 31 namespace JSC { 32 32 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) 36 35 37 36 class RuntimeFlags { … … 92 91 } 93 92 94 bool operator==(const RuntimeFlags& other) const95 {96 return m_flags == other.m_flags;97 }98 99 bool operator!=(const RuntimeFlags& other) const100 {101 return m_flags != other.m_flags;102 }103 104 93 private: 105 94 unsigned m_flags; -
trunk/Source/WebKit/mac/ChangeLog
r201482 r201542 1 2016-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 1 8 2016-05-27 Chris Dumez <cdumez@apple.com> 2 9 -
trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h
r201481 r201542 54 54 55 55 typedef enum { 56 WebKitJavaScriptRuntimeFlagsAsyncAwaitEnabled = 1u << 0,57 56 WebKitJavaScriptRuntimeFlagsAllEnabled = 0 58 57 } WebKitJavaScriptRuntimeFlags; -
trunk/Source/WebKit/win/ChangeLog
r201481 r201542 1 2016-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 1 8 2016-05-27 Caitlin Potter <caitp@igalia.com> 2 9 -
trunk/Source/WebKit/win/Interfaces/IWebPreferencesPrivate.idl
r201481 r201542 33 33 34 34 typedef enum WebKitJavaScriptRuntimeFlags { 35 WebKitJavaScriptRuntimeFlagsAsyncAwaitEnabled = 1, // 1u << 036 35 WebKitJavaScriptRuntimeFlagsAllEnabled = 0 37 36 } WebKitJavaScriptRuntimeFlags; -
trunk/Source/WebKit2/ChangeLog
r201535 r201542 1 2016-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 1 9 2016-05-31 Beth Dakin <bdakin@apple.com> 2 10 -
trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h
r201481 r201542 51 51 52 52 enum WKJavaScriptRuntimeFlags { 53 kWKJavaScriptRuntimeFlagsAsyncAwaitEnabled = 1 << 0,54 53 kWKJavaScriptRuntimeFlagsAllEnabled = 0 55 54 }; -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h
r201481 r201542 44 44 45 45 typedef NS_OPTIONS(NSUInteger, _WKJavaScriptRuntimeFlags) { 46 _WKJavaScriptRuntimeFlagsAsyncAwaitEnabled = 1 << 0,47 46 _WKJavaScriptRuntimeFlagsAllEnabled = 0 48 47 } WK_ENUM_AVAILABLE(10_11, 9_0);
Note:
See TracChangeset
for help on using the changeset viewer.