Changeset 187890 in webkit for trunk/Source/JavaScriptCore/ChangeLog
- Timestamp:
- Aug 4, 2015, 2:26:49 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r187819 r187890 1 2015-08-04 Yusuke Suzuki <[email protected]> 2 3 [ES6] Support Module Syntax 4 https://bugs.webkit.org/show_bug.cgi?id=147422 5 6 Reviewed by Saam Barati. 7 8 This patch introduces ES6 Modules syntax parsing part. 9 In this patch, ASTBuilder just produces the corresponding nodes to the ES6 Modules syntax, 10 and this patch does not include the code generator part. 11 12 Modules require 2 phase parsing. In the first pass, we just analyze the dependent modules 13 and do not execute the body or construct the AST. And after analyzing all the dependent 14 modules, we will parse the dependent modules next. 15 After all analyzing part is done, we will start the second pass. In the second pass, we 16 will parse the module, produce the AST, and execute the body. 17 If we don't do so, we need to create all the ASTs in the module's dependent graph at first 18 because the given module can be executed after the all dependent modules are executed. It 19 means that we need to hold so many parser arenas. To avoid this, the first pass only extracts 20 the dependent modules' information. 21 22 In this patch, we don't add this analyzing part yet. This patch only implements the second pass. 23 This patch aims at just implementing the syntax parsing functionality correctly. 24 After this patch is landed, we will create the ModuleDependencyAnalyzer that inherits SyntaxChecker 25 to collect the dependent modules fast[1]. 26 27 To test the parsing, we added the "checkModuleSyntax" function into jsc shell. 28 By using this, we can parse the given string as the module. 29 30 [1]: https://bugs.webkit.org/show_bug.cgi?id=147353 31 32 * bytecompiler/NodesCodegen.cpp: 33 (JSC::ModuleProgramNode::emitBytecode): 34 (JSC::ImportDeclarationNode::emitBytecode): 35 (JSC::ExportAllDeclarationNode::emitBytecode): 36 (JSC::ExportDefaultDeclarationNode::emitBytecode): 37 (JSC::ExportLocalDeclarationNode::emitBytecode): 38 (JSC::ExportNamedDeclarationNode::emitBytecode): 39 * jsc.cpp: 40 (GlobalObject::finishCreation): 41 (functionCheckModuleSyntax): 42 * parser/ASTBuilder.h: 43 (JSC::ASTBuilder::createModuleSpecifier): 44 (JSC::ASTBuilder::createImportSpecifier): 45 (JSC::ASTBuilder::createImportSpecifierList): 46 (JSC::ASTBuilder::appendImportSpecifier): 47 (JSC::ASTBuilder::createImportDeclaration): 48 (JSC::ASTBuilder::createExportAllDeclaration): 49 (JSC::ASTBuilder::createExportDefaultDeclaration): 50 (JSC::ASTBuilder::createExportLocalDeclaration): 51 (JSC::ASTBuilder::createExportNamedDeclaration): 52 (JSC::ASTBuilder::createExportSpecifier): 53 (JSC::ASTBuilder::createExportSpecifierList): 54 (JSC::ASTBuilder::appendExportSpecifier): 55 * parser/Keywords.table: 56 * parser/NodeConstructors.h: 57 (JSC::ModuleSpecifierNode::ModuleSpecifierNode): 58 (JSC::ImportSpecifierNode::ImportSpecifierNode): 59 (JSC::ImportDeclarationNode::ImportDeclarationNode): 60 (JSC::ExportAllDeclarationNode::ExportAllDeclarationNode): 61 (JSC::ExportDefaultDeclarationNode::ExportDefaultDeclarationNode): 62 (JSC::ExportLocalDeclarationNode::ExportLocalDeclarationNode): 63 (JSC::ExportNamedDeclarationNode::ExportNamedDeclarationNode): 64 (JSC::ExportSpecifierNode::ExportSpecifierNode): 65 * parser/Nodes.cpp: 66 (JSC::ModuleProgramNode::ModuleProgramNode): 67 * parser/Nodes.h: 68 (JSC::ModuleProgramNode::startColumn): 69 (JSC::ModuleProgramNode::endColumn): 70 (JSC::ModuleSpecifierNode::moduleName): 71 (JSC::ImportSpecifierNode::importedName): 72 (JSC::ImportSpecifierNode::localName): 73 (JSC::ImportSpecifierListNode::specifiers): 74 (JSC::ImportSpecifierListNode::append): 75 (JSC::ImportDeclarationNode::specifierList): 76 (JSC::ImportDeclarationNode::moduleSpecifier): 77 (JSC::ExportAllDeclarationNode::moduleSpecifier): 78 (JSC::ExportDefaultDeclarationNode::declaration): 79 (JSC::ExportLocalDeclarationNode::declaration): 80 (JSC::ExportSpecifierNode::exportedName): 81 (JSC::ExportSpecifierNode::localName): 82 (JSC::ExportSpecifierListNode::specifiers): 83 (JSC::ExportSpecifierListNode::append): 84 (JSC::ExportNamedDeclarationNode::specifierList): 85 (JSC::ExportNamedDeclarationNode::moduleSpecifier): 86 * parser/Parser.cpp: 87 (JSC::Parser<LexerType>::Parser): 88 (JSC::Parser<LexerType>::parseInner): 89 (JSC::Parser<LexerType>::parseModuleSourceElements): 90 (JSC::Parser<LexerType>::parseVariableDeclaration): 91 (JSC::Parser<LexerType>::parseVariableDeclarationList): 92 (JSC::Parser<LexerType>::createBindingPattern): 93 (JSC::Parser<LexerType>::tryParseDestructuringPatternExpression): 94 (JSC::Parser<LexerType>::parseDestructuringPattern): 95 (JSC::Parser<LexerType>::parseForStatement): 96 (JSC::Parser<LexerType>::parseFormalParameters): 97 (JSC::Parser<LexerType>::parseFunctionParameters): 98 (JSC::Parser<LexerType>::parseFunctionDeclaration): 99 (JSC::Parser<LexerType>::parseClassDeclaration): 100 (JSC::Parser<LexerType>::parseModuleSpecifier): 101 (JSC::Parser<LexerType>::parseImportClauseItem): 102 (JSC::Parser<LexerType>::parseImportDeclaration): 103 (JSC::Parser<LexerType>::parseExportSpecifier): 104 (JSC::Parser<LexerType>::parseExportDeclaration): 105 (JSC::Parser<LexerType>::parseMemberExpression): 106 * parser/Parser.h: 107 (JSC::isIdentifierOrKeyword): 108 (JSC::ModuleScopeData::create): 109 (JSC::ModuleScopeData::exportedBindings): 110 (JSC::ModuleScopeData::exportName): 111 (JSC::ModuleScopeData::exportBinding): 112 (JSC::Scope::Scope): 113 (JSC::Scope::setIsModule): 114 (JSC::Scope::moduleScopeData): 115 (JSC::Parser::matchContextualKeyword): 116 (JSC::Parser::matchIdentifierOrKeyword): 117 (JSC::Parser::isofToken): Deleted. 118 * parser/ParserModes.h: 119 * parser/ParserTokens.h: 120 * parser/SyntaxChecker.h: 121 (JSC::SyntaxChecker::createModuleSpecifier): 122 (JSC::SyntaxChecker::createImportSpecifier): 123 (JSC::SyntaxChecker::createImportSpecifierList): 124 (JSC::SyntaxChecker::appendImportSpecifier): 125 (JSC::SyntaxChecker::createImportDeclaration): 126 (JSC::SyntaxChecker::createExportAllDeclaration): 127 (JSC::SyntaxChecker::createExportDefaultDeclaration): 128 (JSC::SyntaxChecker::createExportLocalDeclaration): 129 (JSC::SyntaxChecker::createExportNamedDeclaration): 130 (JSC::SyntaxChecker::createExportSpecifier): 131 (JSC::SyntaxChecker::createExportSpecifierList): 132 (JSC::SyntaxChecker::appendExportSpecifier): 133 * runtime/CommonIdentifiers.cpp: 134 (JSC::CommonIdentifiers::CommonIdentifiers): 135 * runtime/CommonIdentifiers.h: 136 * runtime/Completion.cpp: 137 (JSC::checkModuleSyntax): 138 * runtime/Completion.h: 139 * tests/stress/modules-syntax-error-with-names.js: Added. 140 (shouldThrow): 141 * tests/stress/modules-syntax-error.js: Added. 142 (shouldThrow): 143 (checkModuleSyntaxError.checkModuleSyntaxError.checkModuleSyntaxError): 144 * tests/stress/modules-syntax.js: Added. 145 (prototype.checkModuleSyntax): 146 (checkModuleSyntax): 147 * tests/stress/tagged-templates-syntax.js: 148 1 149 2015-08-03 Csaba Osztrogonác <[email protected]> 2 150
Note:
See TracChangeset
for help on using the changeset viewer.