Diff
Modified: trunk/JSTests/ChangeLog (204713 => 204714)
--- trunk/JSTests/ChangeLog 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/JSTests/ChangeLog 2016-08-22 14:12:10 UTC (rev 204714)
@@ -1,3 +1,14 @@
+2016-08-22 Yusuke Suzuki <utatane....@gmail.com>
+
+ [ES6] Module should not allow HTML comments
+ https://bugs.webkit.org/show_bug.cgi?id=161041
+
+ Reviewed by Saam Barati.
+
+ * modules/html-comments.js: Added.
+ (shouldThrow):
+ * test262.yaml:
+
2016-08-21 Yusuke Suzuki <utatane....@gmail.com>
[DFG] Should not fixup AnyIntUse in 32_64
Added: trunk/JSTests/modules/html-comments.js (0 => 204714)
--- trunk/JSTests/modules/html-comments.js (rev 0)
+++ trunk/JSTests/modules/html-comments.js 2016-08-22 14:12:10 UTC (rev 204714)
@@ -0,0 +1,45 @@
+import { shouldBe, shouldThrow } from "./resources/assert.js";
+
+// Eval's goal symbol is Script, not Module.
+shouldBe(eval(`
+<!-- ok
+--> ok
+42
+`), 42);
+
+// Function's goal symbol is not Module.
+shouldBe(new Function(`
+<!-- ok
+--> ok
+return 42
+`)(), 42);
+
+shouldThrow(() => {
+ checkModuleSyntax(`
+ <!-- ng -->
+ `)
+}, `SyntaxError: Unexpected token '<':2`);
+
+shouldThrow(() => {
+ checkModuleSyntax(`
+-->
+ `)
+}, `SyntaxError: Unexpected token '>':2`);
+
+shouldThrow(() => {
+ checkModuleSyntax(`
+ function hello()
+ {
+ <!-- ng -->
+ }
+ `)
+}, `SyntaxError: Unexpected token '<':4`);
+
+shouldThrow(() => {
+ checkModuleSyntax(`
+ function hello()
+ {
+-->
+ }
+ `)
+}, `SyntaxError: Unexpected token '>':4`);
Modified: trunk/JSTests/test262.yaml (204713 => 204714)
--- trunk/JSTests/test262.yaml 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/JSTests/test262.yaml 2016-08-22 14:12:10 UTC (rev 204714)
@@ -70820,11 +70820,11 @@
- path: test262/test/language/literals/string/mongolian-vowel-separator.js
cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
- path: test262/test/language/module-code/comment-multi-line-html-close.js
- cmd: runTest262 :fail, "SyntaxError", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module]
+ cmd: runTest262 :normal, "SyntaxError", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module]
- path: test262/test/language/module-code/comment-single-line-html-close.js
- cmd: runTest262 :fail, "SyntaxError", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module]
+ cmd: runTest262 :normal, "SyntaxError", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module]
- path: test262/test/language/module-code/comment-single-line-html-open.js
- cmd: runTest262 :fail, "SyntaxError", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module]
+ cmd: runTest262 :normal, "SyntaxError", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module]
- path: test262/test/language/module-code/early-dup-export-decl.js
cmd: runTest262 :normal, "SyntaxError", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module]
- path: test262/test/language/module-code/early-dup-export-dflt-id.js
Modified: trunk/Source/_javascript_Core/API/JSScriptRef.cpp (204713 => 204714)
--- trunk/Source/_javascript_Core/API/JSScriptRef.cpp 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/API/JSScriptRef.cpp 2016-08-22 14:12:10 UTC (rev 204714)
@@ -76,7 +76,7 @@
{
return !!JSC::parse<JSC::ProgramNode>(
vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
- JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, SuperBinding::NotNeeded,
+ JSParserStrictMode::NotStrict, JSParserCommentMode::Classic, SourceParseMode::ProgramMode, SuperBinding::NotNeeded,
error);
}
Modified: trunk/Source/_javascript_Core/ChangeLog (204713 => 204714)
--- trunk/Source/_javascript_Core/ChangeLog 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-08-22 14:12:10 UTC (rev 204714)
@@ -1,3 +1,65 @@
+2016-08-22 Yusuke Suzuki <utatane....@gmail.com>
+
+ [ES6] Module should not allow HTML comments
+ https://bugs.webkit.org/show_bug.cgi?id=161041
+
+ Reviewed by Saam Barati.
+
+ ES6 Modules intentionally disable HTML comments[1].
+
+ [1]: https://tc39.github.io/ecma262/#sec-html-like-comments
+
+ * API/JSScriptRef.cpp:
+ (parseScript):
+ * builtins/BuiltinExecutables.cpp:
+ (JSC::BuiltinExecutables::createExecutable):
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::CacheKey::CacheKey):
+ * bytecode/ExecutableInfo.h:
+ (JSC::ExecutableInfo::ExecutableInfo):
+ (JSC::ExecutableInfo::commentMode):
+ (JSC::ExecutableInfo::superBinding): Deleted.
+ * bytecode/UnlinkedCodeBlock.cpp:
+ (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
+ * bytecode/UnlinkedCodeBlock.h:
+ (JSC::UnlinkedCodeBlock::commentMode):
+ (JSC::UnlinkedCodeBlock::superBinding): Deleted.
+ * bytecode/UnlinkedFunctionExecutable.cpp:
+ (JSC::generateUnlinkedFunctionCodeBlock):
+ (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
+ * bytecode/UnlinkedFunctionExecutable.h:
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::commentMode):
+ (JSC::BytecodeGenerator::makeFunction):
+ (JSC::BytecodeGenerator::superBinding): Deleted.
+ * parser/Lexer.cpp:
+ (JSC::Lexer<T>::Lexer):
+ (JSC::Lexer<T>::lex):
+ * parser/Lexer.h:
+ * parser/Parser.cpp:
+ (JSC::Parser<LexerType>::Parser):
+ * parser/Parser.h:
+ (JSC::parse):
+ * parser/ParserModes.h:
+ * parser/SourceCodeKey.h:
+ (JSC::SourceCodeFlags::SourceCodeFlags):
+ (JSC::SourceCodeKey::SourceCodeKey):
+ * runtime/CodeCache.cpp:
+ (JSC::CodeCache::getGlobalCodeBlock):
+ (JSC::CodeCache::getProgramCodeBlock):
+ (JSC::CodeCache::getEvalCodeBlock):
+ (JSC::CodeCache::getModuleProgramCodeBlock):
+ (JSC::CodeCache::getFunctionExecutableFromGlobalCode):
+ * runtime/CodeCache.h:
+ * runtime/Completion.cpp:
+ (JSC::checkSyntax):
+ (JSC::checkModuleSyntax):
+ * runtime/Executable.cpp:
+ (JSC::ProgramExecutable::checkSyntax):
+ * runtime/Executable.h:
+ * runtime/ModuleLoaderPrototype.cpp:
+ (JSC::moduleLoaderPrototypeParseModule):
+
2016-08-21 Yusuke Suzuki <utatane....@gmail.com>
[DFG] Should not fixup AnyIntUse in 32_64
Modified: trunk/Source/_javascript_Core/builtins/BuiltinExecutables.cpp (204713 => 204714)
--- trunk/Source/_javascript_Core/builtins/BuiltinExecutables.cpp 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/builtins/BuiltinExecutables.cpp 2016-08-22 14:12:10 UTC (rev 204714)
@@ -80,7 +80,7 @@
RefPtr<SourceProvider> sourceOverride = isParsingDefaultConstructor ? source.provider() : nullptr;
std::unique_ptr<ProgramNode> program = parse<ProgramNode>(
&vm, source, Identifier(), builtinMode,
- JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, error,
+ JSParserStrictMode::NotStrict, JSParserCommentMode::Classic, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, error,
&positionBeforeLastNewline, constructorKind);
if (!program) {
@@ -106,7 +106,7 @@
RELEASE_ASSERT(metadata);
metadata->overrideName(name);
VariableEnvironment dummyTDZVariables;
- UnlinkedFunctionExecutable* functionExecutable = UnlinkedFunctionExecutable::create(&vm, source, metadata, kind, constructAbility, dummyTDZVariables, DerivedContextType::None, WTFMove(sourceOverride));
+ UnlinkedFunctionExecutable* functionExecutable = UnlinkedFunctionExecutable::create(&vm, source, metadata, kind, constructAbility, JSParserCommentMode::Classic, dummyTDZVariables, DerivedContextType::None, WTFMove(sourceOverride));
return functionExecutable;
}
Modified: trunk/Source/_javascript_Core/bytecode/EvalCodeCache.h (204713 => 204714)
--- trunk/Source/_javascript_Core/bytecode/EvalCodeCache.h 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/bytecode/EvalCodeCache.h 2016-08-22 14:12:10 UTC (rev 204714)
@@ -50,7 +50,7 @@
public:
CacheKey(const String& source, DerivedContextType derivedContextType, EvalContextType evalContextType, bool isArrowFunctionContext)
: m_source(source.impl())
- , m_flags(SourceCodeType::EvalType, JSParserBuiltinMode::NotBuiltin, JSParserStrictMode::NotStrict, derivedContextType, evalContextType, isArrowFunctionContext)
+ , m_flags(SourceCodeType::EvalType, JSParserBuiltinMode::NotBuiltin, JSParserStrictMode::NotStrict, JSParserCommentMode::Classic, derivedContextType, evalContextType, isArrowFunctionContext)
{
}
Modified: trunk/Source/_javascript_Core/bytecode/ExecutableInfo.h (204713 => 204714)
--- trunk/Source/_javascript_Core/bytecode/ExecutableInfo.h 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/bytecode/ExecutableInfo.h 2016-08-22 14:12:10 UTC (rev 204714)
@@ -36,7 +36,7 @@
// FIXME: These flags, ParserModes and propagation to XXXCodeBlocks should be reorganized.
// https://bugs.webkit.org/show_bug.cgi?id=151547
struct ExecutableInfo {
- ExecutableInfo(bool usesEval, bool isStrictMode, bool isConstructor, bool isBuiltinFunction, ConstructorKind constructorKind, SuperBinding superBinding, SourceParseMode parseMode, DerivedContextType derivedContextType, bool isArrowFunctionContext, bool isClassContext, EvalContextType evalContextType)
+ ExecutableInfo(bool usesEval, bool isStrictMode, bool isConstructor, bool isBuiltinFunction, ConstructorKind constructorKind, JSParserCommentMode commentMode, SuperBinding superBinding, SourceParseMode parseMode, DerivedContextType derivedContextType, bool isArrowFunctionContext, bool isClassContext, EvalContextType evalContextType)
: m_usesEval(usesEval)
, m_isStrictMode(isStrictMode)
, m_isConstructor(isConstructor)
@@ -43,6 +43,7 @@
, m_isBuiltinFunction(isBuiltinFunction)
, m_constructorKind(static_cast<unsigned>(constructorKind))
, m_superBinding(static_cast<unsigned>(superBinding))
+ , m_commentMode(static_cast<unsigned>(commentMode))
, m_parseMode(parseMode)
, m_derivedContextType(static_cast<unsigned>(derivedContextType))
, m_isArrowFunctionContext(isArrowFunctionContext)
@@ -51,6 +52,7 @@
{
ASSERT(m_constructorKind == static_cast<unsigned>(constructorKind));
ASSERT(m_superBinding == static_cast<unsigned>(superBinding));
+ ASSERT(m_commentMode == static_cast<unsigned>(commentMode));
}
bool usesEval() const { return m_usesEval; }
@@ -59,6 +61,7 @@
bool isBuiltinFunction() const { return m_isBuiltinFunction; }
ConstructorKind constructorKind() const { return static_cast<ConstructorKind>(m_constructorKind); }
SuperBinding superBinding() const { return static_cast<SuperBinding>(m_superBinding); }
+ JSParserCommentMode commentMode() const { return static_cast<JSParserCommentMode>(m_commentMode); }
SourceParseMode parseMode() const { return m_parseMode; }
DerivedContextType derivedContextType() const { return static_cast<DerivedContextType>(m_derivedContextType); }
EvalContextType evalContextType() const { return static_cast<EvalContextType>(m_evalContextType); }
@@ -72,6 +75,7 @@
unsigned m_isBuiltinFunction : 1;
unsigned m_constructorKind : 2;
unsigned m_superBinding : 1;
+ unsigned m_commentMode: 1;
SourceParseMode m_parseMode;
unsigned m_derivedContextType : 2;
unsigned m_isArrowFunctionContext : 1;
Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.cpp (204713 => 204714)
--- trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.cpp 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.cpp 2016-08-22 14:12:10 UTC (rev 204714)
@@ -62,13 +62,14 @@
, m_isConstructor(info.isConstructor())
, m_hasCapturedVariables(false)
, m_isBuiltinFunction(info.isBuiltinFunction())
- , m_constructorKind(static_cast<unsigned>(info.constructorKind()))
, m_superBinding(static_cast<unsigned>(info.superBinding()))
- , m_derivedContextType(static_cast<unsigned>(info.derivedContextType()))
- , m_evalContextType(static_cast<unsigned>(info.evalContextType()))
+ , m_commentMode(static_cast<unsigned>(info.commentMode()))
, m_isArrowFunctionContext(info.isArrowFunctionContext())
, m_isClassContext(info.isClassContext())
, m_wasCompiledWithDebuggingOpcodes(debuggerMode == DebuggerMode::DebuggerOn || Options::forceDebuggerBytecodeGeneration())
+ , m_constructorKind(static_cast<unsigned>(info.constructorKind()))
+ , m_derivedContextType(static_cast<unsigned>(info.derivedContextType()))
+ , m_evalContextType(static_cast<unsigned>(info.evalContextType()))
, m_firstLine(0)
, m_lineCount(0)
, m_endColumn(UINT_MAX)
Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.h (204713 => 204714)
--- trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.h 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.h 2016-08-22 14:12:10 UTC (rev 204714)
@@ -204,6 +204,7 @@
ConstructorKind constructorKind() const { return static_cast<ConstructorKind>(m_constructorKind); }
SuperBinding superBinding() const { return static_cast<SuperBinding>(m_superBinding); }
+ JSParserCommentMode commentMode() const { return static_cast<JSParserCommentMode>(m_commentMode); }
void shrinkToFit()
{
@@ -405,13 +406,14 @@
unsigned m_isConstructor : 1;
unsigned m_hasCapturedVariables : 1;
unsigned m_isBuiltinFunction : 1;
- unsigned m_constructorKind : 2;
unsigned m_superBinding : 1;
- unsigned m_derivedContextType : 2;
- unsigned m_evalContextType : 2;
+ unsigned m_commentMode: 1;
unsigned m_isArrowFunctionContext : 1;
unsigned m_isClassContext : 1;
unsigned m_wasCompiledWithDebuggingOpcodes : 1;
+ unsigned m_constructorKind : 2;
+ unsigned m_derivedContextType : 2;
+ unsigned m_evalContextType : 2;
unsigned m_firstLine;
unsigned m_lineCount;
unsigned m_endColumn;
Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.cpp (204713 => 204714)
--- trunk/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.cpp 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.cpp 2016-08-22 14:12:10 UTC (rev 204714)
@@ -51,9 +51,10 @@
{
JSParserBuiltinMode builtinMode = executable->isBuiltinFunction() ? JSParserBuiltinMode::Builtin : JSParserBuiltinMode::NotBuiltin;
JSParserStrictMode strictMode = executable->isInStrictContext() ? JSParserStrictMode::Strict : JSParserStrictMode::NotStrict;
+ JSParserCommentMode commentMode = executable->commentMode();
ASSERT(isFunctionParseMode(executable->parseMode()));
std::unique_ptr<FunctionNode> function = parse<FunctionNode>(
- &vm, source, executable->name(), builtinMode, strictMode, executable->parseMode(), executable->superBinding(), error, nullptr);
+ &vm, source, executable->name(), builtinMode, strictMode, commentMode, executable->parseMode(), executable->superBinding(), error, nullptr);
if (!function) {
ASSERT(error.isValid());
@@ -65,7 +66,7 @@
bool isClassContext = executable->superBinding() == SuperBinding::Needed;
- UnlinkedFunctionCodeBlock* result = UnlinkedFunctionCodeBlock::create(&vm, FunctionCode, ExecutableInfo(function->usesEval(), function->isStrictMode(), kind == CodeForConstruct, functionKind == UnlinkedBuiltinFunction, executable->constructorKind(), executable->superBinding(), parseMode, executable->derivedContextType(), false, isClassContext, EvalContextType::FunctionEvalContext), debuggerMode);
+ UnlinkedFunctionCodeBlock* result = UnlinkedFunctionCodeBlock::create(&vm, FunctionCode, ExecutableInfo(function->usesEval(), function->isStrictMode(), kind == CodeForConstruct, functionKind == UnlinkedBuiltinFunction, executable->constructorKind(), commentMode, executable->superBinding(), parseMode, executable->derivedContextType(), false, isClassContext, EvalContextType::FunctionEvalContext), debuggerMode);
error = BytecodeGenerator::generate(vm, function.get(), result, debuggerMode, executable->parentScopeTDZVariables());
@@ -74,7 +75,7 @@
return result;
}
-UnlinkedFunctionExecutable::UnlinkedFunctionExecutable(VM* vm, Structure* structure, const SourceCode& source, RefPtr<SourceProvider>&& sourceOverride, FunctionMetadataNode* node, UnlinkedFunctionKind kind, ConstructAbility constructAbility, VariableEnvironment& parentScopeTDZVariables, DerivedContextType derivedContextType)
+UnlinkedFunctionExecutable::UnlinkedFunctionExecutable(VM* vm, Structure* structure, const SourceCode& source, RefPtr<SourceProvider>&& sourceOverride, FunctionMetadataNode* node, UnlinkedFunctionKind kind, ConstructAbility constructAbility, JSParserCommentMode commentMode, VariableEnvironment& parentScopeTDZVariables, DerivedContextType derivedContextType)
: Base(*vm, structure)
, m_firstLineOffset(node->firstLine() - source.firstLine())
, m_lineCount(node->lastLine() - node->firstLine())
@@ -94,6 +95,7 @@
, m_constructAbility(static_cast<unsigned>(constructAbility))
, m_constructorKind(static_cast<unsigned>(node->constructorKind()))
, m_functionMode(static_cast<unsigned>(node->functionMode()))
+ , m_commentMode(static_cast<unsigned>(commentMode))
, m_superBinding(static_cast<unsigned>(node->superBinding()))
, m_derivedContextType(static_cast<unsigned>(derivedContextType))
, m_sourceParseMode(static_cast<unsigned>(node->parseMode()))
@@ -107,6 +109,7 @@
ASSERT(m_constructAbility == static_cast<unsigned>(constructAbility));
ASSERT(m_constructorKind == static_cast<unsigned>(node->constructorKind()));
ASSERT(m_functionMode == static_cast<unsigned>(node->functionMode()));
+ ASSERT(m_commentMode == static_cast<unsigned>(commentMode));
ASSERT(m_superBinding == static_cast<unsigned>(node->superBinding()));
ASSERT(m_derivedContextType == static_cast<unsigned>(derivedContextType));
ASSERT(m_sourceParseMode == static_cast<unsigned>(node->parseMode()));
Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.h (204713 => 204714)
--- trunk/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.h 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.h 2016-08-22 14:12:10 UTC (rev 204714)
@@ -64,10 +64,10 @@
typedef JSCell Base;
static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
- static UnlinkedFunctionExecutable* create(VM* vm, const SourceCode& source, FunctionMetadataNode* node, UnlinkedFunctionKind unlinkedFunctionKind, ConstructAbility constructAbility, VariableEnvironment& parentScopeTDZVariables, DerivedContextType derivedContextType, RefPtr<SourceProvider>&& sourceOverride = nullptr)
+ static UnlinkedFunctionExecutable* create(VM* vm, const SourceCode& source, FunctionMetadataNode* node, UnlinkedFunctionKind unlinkedFunctionKind, ConstructAbility constructAbility, JSParserCommentMode commentMode, VariableEnvironment& parentScopeTDZVariables, DerivedContextType derivedContextType, RefPtr<SourceProvider>&& sourceOverride = nullptr)
{
UnlinkedFunctionExecutable* instance = new (NotNull, allocateCell<UnlinkedFunctionExecutable>(vm->heap))
- UnlinkedFunctionExecutable(vm, vm->unlinkedFunctionExecutableStructure.get(), source, WTFMove(sourceOverride), node, unlinkedFunctionKind, constructAbility, parentScopeTDZVariables, derivedContextType);
+ UnlinkedFunctionExecutable(vm, vm->unlinkedFunctionExecutableStructure.get(), source, WTFMove(sourceOverride), node, unlinkedFunctionKind, constructAbility, commentMode, parentScopeTDZVariables, derivedContextType);
instance->finishCreation(*vm);
return instance;
}
@@ -127,6 +127,7 @@
bool isBuiltinFunction() const { return m_isBuiltinFunction; }
ConstructAbility constructAbility() const { return static_cast<ConstructAbility>(m_constructAbility); }
+ JSParserCommentMode commentMode() const { return static_cast<JSParserCommentMode>(m_commentMode); }
bool isClassConstructorFunction() const { return constructorKind() != ConstructorKind::None; }
const VariableEnvironment* parentScopeTDZVariables() const { return &m_parentScopeTDZVariables; }
@@ -140,7 +141,7 @@
void setSourceMappingURLDirective(const String& sourceMappingURL) { m_sourceMappingURLDirective = sourceMappingURL; }
private:
- UnlinkedFunctionExecutable(VM*, Structure*, const SourceCode&, RefPtr<SourceProvider>&& sourceOverride, FunctionMetadataNode*, UnlinkedFunctionKind, ConstructAbility, VariableEnvironment&, JSC::DerivedContextType);
+ UnlinkedFunctionExecutable(VM*, Structure*, const SourceCode&, RefPtr<SourceProvider>&& sourceOverride, FunctionMetadataNode*, UnlinkedFunctionKind, ConstructAbility, JSParserCommentMode, VariableEnvironment&, JSC::DerivedContextType);
unsigned m_firstLineOffset;
unsigned m_lineCount;
@@ -160,6 +161,7 @@
unsigned m_constructAbility: 1;
unsigned m_constructorKind : 2;
unsigned m_functionMode : 2; // FunctionMode
+ unsigned m_commentMode: 1; // JSParserCommentMode
unsigned m_superBinding : 1;
unsigned m_derivedContextType: 2;
unsigned m_sourceParseMode : 4; // SourceParseMode
Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h (204713 => 204714)
--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h 2016-08-22 14:12:10 UTC (rev 204714)
@@ -285,6 +285,7 @@
bool usesThis() const { return m_scopeNode->usesThis(); }
ConstructorKind constructorKind() const { return m_codeBlock->constructorKind(); }
SuperBinding superBinding() const { return m_codeBlock->superBinding(); }
+ JSParserCommentMode commentMode() const { return m_codeBlock->commentMode(); }
template<typename... Args>
static ParserError generate(VM& vm, Args&& ...args)
@@ -843,7 +844,7 @@
else if (parseMode == SourceParseMode::MethodMode && metadata->constructorKind() == ConstructorKind::None)
constructAbility = ConstructAbility::CannotConstruct;
- return UnlinkedFunctionExecutable::create(m_vm, m_scopeNode->source(), metadata, isBuiltinFunction() ? UnlinkedBuiltinFunction : UnlinkedNormalFunction, constructAbility, variablesUnderTDZ, newDerivedContextType);
+ return UnlinkedFunctionExecutable::create(m_vm, m_scopeNode->source(), metadata, isBuiltinFunction() ? UnlinkedBuiltinFunction : UnlinkedNormalFunction, constructAbility, commentMode(), variablesUnderTDZ, newDerivedContextType);
}
void getVariablesUnderTDZ(VariableEnvironment&);
Modified: trunk/Source/_javascript_Core/parser/Lexer.cpp (204713 => 204714)
--- trunk/Source/_javascript_Core/parser/Lexer.cpp 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/parser/Lexer.cpp 2016-08-22 14:12:10 UTC (rev 204714)
@@ -486,10 +486,11 @@
};
template <typename T>
-Lexer<T>::Lexer(VM* vm, JSParserBuiltinMode builtinMode)
+Lexer<T>::Lexer(VM* vm, JSParserBuiltinMode builtinMode, JSParserCommentMode commentMode)
: m_isReparsingFunction(false)
, m_vm(vm)
, m_parsingBuiltinFunction(builtinMode == JSParserBuiltinMode::Builtin)
+ , m_commentMode(commentMode)
{
}
@@ -1883,8 +1884,10 @@
case CharacterLess:
shift();
if (m_current == '!' && peek(1) == '-' && peek(2) == '-') {
- // <!-- marks the beginning of a line comment (for www usage)
- goto inSingleLineComment;
+ if (m_commentMode == JSParserCommentMode::Classic) {
+ // <!-- marks the beginning of a line comment (for www usage)
+ goto inSingleLineComment;
+ }
}
if (m_current == '<') {
shift();
@@ -1936,8 +1939,10 @@
if (m_current == '-') {
shift();
if (m_atLineStart && m_current == '>') {
- shift();
- goto inSingleLineComment;
+ if (m_commentMode == JSParserCommentMode::Classic) {
+ shift();
+ goto inSingleLineComment;
+ }
}
token = (!m_terminator) ? MINUSMINUS : AUTOMINUSMINUS;
break;
Modified: trunk/Source/_javascript_Core/parser/Lexer.h (204713 => 204714)
--- trunk/Source/_javascript_Core/parser/Lexer.h 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/parser/Lexer.h 2016-08-22 14:12:10 UTC (rev 204714)
@@ -48,7 +48,7 @@
WTF_MAKE_FAST_ALLOCATED;
public:
- Lexer(VM*, JSParserBuiltinMode);
+ Lexer(VM*, JSParserBuiltinMode, JSParserCommentMode);
~Lexer();
// Character manipulation functions.
@@ -216,6 +216,7 @@
VM* m_vm;
bool m_parsingBuiltinFunction;
+ JSParserCommentMode m_commentMode;
};
template <>
Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (204713 => 204714)
--- trunk/Source/_javascript_Core/parser/Parser.cpp 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp 2016-08-22 14:12:10 UTC (rev 204714)
@@ -189,7 +189,7 @@
}
template <typename LexerType>
-Parser<LexerType>::Parser(VM* vm, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, SourceParseMode parseMode, SuperBinding superBinding, ConstructorKind defaultConstructorKind, DerivedContextType derivedContextType, bool isEvalContext, EvalContextType evalContextType)
+Parser<LexerType>::Parser(VM* vm, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, JSParserCommentMode commentMode, SourceParseMode parseMode, SuperBinding superBinding, ConstructorKind defaultConstructorKind, DerivedContextType derivedContextType, bool isEvalContext, EvalContextType evalContextType)
: m_vm(vm)
, m_source(&source)
, m_hasStackOverflow(false)
@@ -198,11 +198,12 @@
, m_statementDepth(0)
, m_sourceElements(0)
, m_parsingBuiltin(builtinMode == JSParserBuiltinMode::Builtin)
+ , m_commentMode(commentMode)
, m_superBinding(superBinding)
, m_defaultConstructorKind(defaultConstructorKind)
, m_immediateParentAllowsFunctionDeclarationInStatement(false)
{
- m_lexer = std::make_unique<LexerType>(vm, builtinMode);
+ m_lexer = std::make_unique<LexerType>(vm, builtinMode, commentMode);
m_lexer->setCode(source, &m_parserArena);
m_token.m_location.line = source.firstLine();
m_token.m_location.startOffset = source.startOffset();
Modified: trunk/Source/_javascript_Core/parser/Parser.h (204713 => 204714)
--- trunk/Source/_javascript_Core/parser/Parser.h 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/parser/Parser.h 2016-08-22 14:12:10 UTC (rev 204714)
@@ -793,7 +793,7 @@
WTF_MAKE_FAST_ALLOCATED;
public:
- Parser(VM*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, SourceParseMode, SuperBinding, ConstructorKind defaultConstructorKind = ConstructorKind::None, DerivedContextType = DerivedContextType::None, bool isEvalContext = false, EvalContextType = EvalContextType::None);
+ Parser(VM*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, JSParserCommentMode, SourceParseMode, SuperBinding, ConstructorKind defaultConstructorKind = ConstructorKind::None, DerivedContextType = DerivedContextType::None, bool isEvalContext = false, EvalContextType = EvalContextType::None);
~Parser();
template <class ParsedNode>
@@ -1583,6 +1583,7 @@
RefPtr<SourceProviderCache> m_functionCache;
SourceElements* m_sourceElements;
bool m_parsingBuiltin;
+ JSParserCommentMode m_commentMode;
SuperBinding m_superBinding;
ConstructorKind m_defaultConstructorKind;
VariableEnvironment m_varDeclarations;
@@ -1712,13 +1713,13 @@
std::unique_ptr<ParsedNode> parse(
VM* vm, const SourceCode& source,
const Identifier& name, JSParserBuiltinMode builtinMode,
- JSParserStrictMode strictMode, SourceParseMode parseMode, SuperBinding superBinding,
+ JSParserStrictMode strictMode, JSParserCommentMode commentMode, SourceParseMode parseMode, SuperBinding superBinding,
ParserError& error, JSTextPosition* positionBeforeLastNewline = nullptr,
ConstructorKind defaultConstructorKind = ConstructorKind::None, DerivedContextType derivedContextType = DerivedContextType::None, EvalContextType evalContextType = EvalContextType::None)
{
ASSERT(!source.provider()->source().isNull());
if (source.provider()->source().is8Bit()) {
- Parser<Lexer<LChar>> parser(vm, source, builtinMode, strictMode, parseMode, superBinding, defaultConstructorKind, derivedContextType, isEvalNode<ParsedNode>(), evalContextType);
+ Parser<Lexer<LChar>> parser(vm, source, builtinMode, strictMode, commentMode, parseMode, superBinding, defaultConstructorKind, derivedContextType, isEvalNode<ParsedNode>(), evalContextType);
std::unique_ptr<ParsedNode> result = parser.parse<ParsedNode>(error, name, parseMode);
if (positionBeforeLastNewline)
*positionBeforeLastNewline = parser.positionBeforeLastNewline();
@@ -1729,7 +1730,7 @@
return result;
}
ASSERT_WITH_MESSAGE(defaultConstructorKind == ConstructorKind::None, "BuiltinExecutables::createDefaultConstructor should always use a 8-bit string");
- Parser<Lexer<UChar>> parser(vm, source, builtinMode, strictMode, parseMode, superBinding, defaultConstructorKind, derivedContextType, isEvalNode<ParsedNode>(), evalContextType);
+ Parser<Lexer<UChar>> parser(vm, source, builtinMode, strictMode, commentMode, parseMode, superBinding, defaultConstructorKind, derivedContextType, isEvalNode<ParsedNode>(), evalContextType);
std::unique_ptr<ParsedNode> result = parser.parse<ParsedNode>(error, name, parseMode);
if (positionBeforeLastNewline)
*positionBeforeLastNewline = parser.positionBeforeLastNewline();
Modified: trunk/Source/_javascript_Core/parser/ParserModes.h (204713 => 204714)
--- trunk/Source/_javascript_Core/parser/ParserModes.h 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/parser/ParserModes.h 2016-08-22 14:12:10 UTC (rev 204714)
@@ -33,6 +33,7 @@
enum class JSParserStrictMode { NotStrict, Strict };
enum class JSParserBuiltinMode { NotBuiltin, Builtin };
+enum class JSParserCommentMode { Classic, Module };
enum class JSParserCodeType { Program, Function, Module };
enum class ConstructorKind { None, Base, Extends };
Modified: trunk/Source/_javascript_Core/parser/SourceCodeKey.h (204713 => 204714)
--- trunk/Source/_javascript_Core/parser/SourceCodeKey.h 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/parser/SourceCodeKey.h 2016-08-22 14:12:10 UTC (rev 204714)
@@ -39,8 +39,9 @@
public:
SourceCodeFlags() = default;
- SourceCodeFlags(SourceCodeType codeType, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DerivedContextType derivedContextType, EvalContextType evalContextType, bool isArrowFunctionContext)
+ SourceCodeFlags(SourceCodeType codeType, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, JSParserCommentMode commentMode, DerivedContextType derivedContextType, EvalContextType evalContextType, bool isArrowFunctionContext)
: m_flags(
+ (static_cast<unsigned>(commentMode) << 8) |
(static_cast<unsigned>(isArrowFunctionContext) << 7) |
(static_cast<unsigned>(evalContextType) << 6) |
(static_cast<unsigned>(derivedContextType) << 4) |
@@ -66,10 +67,10 @@
{
}
- SourceCodeKey(const SourceCode& sourceCode, const String& name, SourceCodeType codeType, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DerivedContextType derivedContextType, EvalContextType evalContextType, bool isArrowFunctionContext)
+ SourceCodeKey(const SourceCode& sourceCode, const String& name, SourceCodeType codeType, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, JSParserCommentMode commentMode, DerivedContextType derivedContextType, EvalContextType evalContextType, bool isArrowFunctionContext)
: m_sourceCode(sourceCode)
, m_name(name)
- , m_flags(codeType, builtinMode, strictMode, derivedContextType, evalContextType, isArrowFunctionContext)
+ , m_flags(codeType, builtinMode, strictMode, commentMode, derivedContextType, evalContextType, isArrowFunctionContext)
, m_hash(sourceCode.hash())
{
}
Modified: trunk/Source/_javascript_Core/runtime/CodeCache.cpp (204713 => 204714)
--- trunk/Source/_javascript_Core/runtime/CodeCache.cpp 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/runtime/CodeCache.cpp 2016-08-22 14:12:10 UTC (rev 204714)
@@ -81,11 +81,11 @@
};
template <class UnlinkedCodeBlockType, class ExecutableType>
-UnlinkedCodeBlockType* CodeCache::getGlobalCodeBlock(VM& vm, ExecutableType* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ParserError& error, EvalContextType evalContextType, const VariableEnvironment* variablesUnderTDZ)
+UnlinkedCodeBlockType* CodeCache::getGlobalCodeBlock(VM& vm, ExecutableType* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, JSParserCommentMode commentMode, DebuggerMode debuggerMode, ParserError& error, EvalContextType evalContextType, const VariableEnvironment* variablesUnderTDZ)
{
DerivedContextType derivedContextType = executable->derivedContextType();
bool isArrowFunctionContext = executable->isArrowFunctionContext();
- SourceCodeKey key(source, String(), CacheTypes<UnlinkedCodeBlockType>::codeType, builtinMode, strictMode, derivedContextType, evalContextType, isArrowFunctionContext);
+ SourceCodeKey key(source, String(), CacheTypes<UnlinkedCodeBlockType>::codeType, builtinMode, strictMode, commentMode, derivedContextType, evalContextType, isArrowFunctionContext);
SourceCodeValue* cache = m_sourceCode.findCacheAndUpdateAge(key);
// FIXME: We should do something smart for TDZ instead of just disabling caching.
// https://bugs.webkit.org/show_bug.cgi?id=154010
@@ -104,7 +104,7 @@
}
typedef typename CacheTypes<UnlinkedCodeBlockType>::RootNode RootNode;
std::unique_ptr<RootNode> rootNode = parse<RootNode>(
- &vm, source, Identifier(), builtinMode, strictMode, CacheTypes<UnlinkedCodeBlockType>::parseMode, SuperBinding::NotNeeded, error, nullptr, ConstructorKind::None, derivedContextType, evalContextType);
+ &vm, source, Identifier(), builtinMode, strictMode, commentMode, CacheTypes<UnlinkedCodeBlockType>::parseMode, SuperBinding::NotNeeded, error, nullptr, ConstructorKind::None, derivedContextType, evalContextType);
if (!rootNode)
return nullptr;
@@ -136,18 +136,18 @@
UnlinkedProgramCodeBlock* CodeCache::getProgramCodeBlock(VM& vm, ProgramExecutable* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ParserError& error)
{
VariableEnvironment emptyParentTDZVariables;
- return getGlobalCodeBlock<UnlinkedProgramCodeBlock>(vm, executable, source, builtinMode, strictMode, debuggerMode, error, EvalContextType::None, &emptyParentTDZVariables);
+ return getGlobalCodeBlock<UnlinkedProgramCodeBlock>(vm, executable, source, builtinMode, strictMode, JSParserCommentMode::Classic, debuggerMode, error, EvalContextType::None, &emptyParentTDZVariables);
}
UnlinkedEvalCodeBlock* CodeCache::getEvalCodeBlock(VM& vm, EvalExecutable* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ParserError& error, EvalContextType evalContextType, const VariableEnvironment* variablesUnderTDZ)
{
- return getGlobalCodeBlock<UnlinkedEvalCodeBlock>(vm, executable, source, builtinMode, strictMode, debuggerMode, error, evalContextType, variablesUnderTDZ);
+ return getGlobalCodeBlock<UnlinkedEvalCodeBlock>(vm, executable, source, builtinMode, strictMode, JSParserCommentMode::Classic, debuggerMode, error, evalContextType, variablesUnderTDZ);
}
UnlinkedModuleProgramCodeBlock* CodeCache::getModuleProgramCodeBlock(VM& vm, ModuleProgramExecutable* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, DebuggerMode debuggerMode, ParserError& error)
{
VariableEnvironment emptyParentTDZVariables;
- return getGlobalCodeBlock<UnlinkedModuleProgramCodeBlock>(vm, executable, source, builtinMode, JSParserStrictMode::Strict, debuggerMode, error, EvalContextType::None, &emptyParentTDZVariables);
+ return getGlobalCodeBlock<UnlinkedModuleProgramCodeBlock>(vm, executable, source, builtinMode, JSParserStrictMode::Strict, JSParserCommentMode::Module, debuggerMode, error, EvalContextType::None, &emptyParentTDZVariables);
}
// FIXME: There's no need to add the function's name to the key here. It's already in the source code.
@@ -158,6 +158,7 @@
source, name.string(), SourceCodeType::FunctionType,
JSParserBuiltinMode::NotBuiltin,
JSParserStrictMode::NotStrict,
+ JSParserCommentMode::Classic,
DerivedContextType::None,
EvalContextType::None,
isArrowFunctionContext);
@@ -172,7 +173,7 @@
JSTextPosition positionBeforeLastNewline;
std::unique_ptr<ProgramNode> program = parse<ProgramNode>(
&vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
- JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, SuperBinding::NotNeeded,
+ JSParserStrictMode::NotStrict, JSParserCommentMode::Classic, SourceParseMode::ProgramMode, SuperBinding::NotNeeded,
error, &positionBeforeLastNewline);
if (!program) {
RELEASE_ASSERT(error.isValid());
@@ -201,7 +202,7 @@
metadata->setEndPosition(positionBeforeLastNewline);
// The Function constructor only has access to global variables, so no variables will be under TDZ.
VariableEnvironment emptyTDZVariables;
- UnlinkedFunctionExecutable* functionExecutable = UnlinkedFunctionExecutable::create(&vm, source, metadata, UnlinkedNormalFunction, ConstructAbility::CanConstruct, emptyTDZVariables, DerivedContextType::None);
+ UnlinkedFunctionExecutable* functionExecutable = UnlinkedFunctionExecutable::create(&vm, source, metadata, UnlinkedNormalFunction, ConstructAbility::CanConstruct, JSParserCommentMode::Classic, emptyTDZVariables, DerivedContextType::None);
functionExecutable->setSourceURLDirective(source.provider()->sourceURL());
functionExecutable->setSourceMappingURLDirective(source.provider()->sourceMappingURL());
Modified: trunk/Source/_javascript_Core/runtime/CodeCache.h (204713 => 204714)
--- trunk/Source/_javascript_Core/runtime/CodeCache.h 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/runtime/CodeCache.h 2016-08-22 14:12:10 UTC (rev 204714)
@@ -199,7 +199,7 @@
private:
template <class UnlinkedCodeBlockType, class ExecutableType>
- UnlinkedCodeBlockType* getGlobalCodeBlock(VM&, ExecutableType*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, DebuggerMode, ParserError&, EvalContextType, const VariableEnvironment*);
+ UnlinkedCodeBlockType* getGlobalCodeBlock(VM&, ExecutableType*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, JSParserCommentMode, DebuggerMode, ParserError&, EvalContextType, const VariableEnvironment*);
CodeCacheMap m_sourceCode;
};
Modified: trunk/Source/_javascript_Core/runtime/Completion.cpp (204713 => 204714)
--- trunk/Source/_javascript_Core/runtime/Completion.cpp 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/runtime/Completion.cpp 2016-08-22 14:12:10 UTC (rev 204714)
@@ -65,7 +65,7 @@
RELEASE_ASSERT(vm.atomicStringTable() == wtfThreadData().atomicStringTable());
return !!parse<ProgramNode>(
&vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
- JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, error);
+ JSParserStrictMode::NotStrict, JSParserCommentMode::Classic, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, error);
}
bool checkModuleSyntax(ExecState* exec, const SourceCode& source, ParserError& error)
@@ -75,7 +75,7 @@
RELEASE_ASSERT(vm.atomicStringTable() == wtfThreadData().atomicStringTable());
std::unique_ptr<ModuleProgramNode> moduleProgramNode = parse<ModuleProgramNode>(
&vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
- JSParserStrictMode::Strict, SourceParseMode::ModuleAnalyzeMode, SuperBinding::NotNeeded, error);
+ JSParserStrictMode::Strict, JSParserCommentMode::Module, SourceParseMode::ModuleAnalyzeMode, SuperBinding::NotNeeded, error);
if (!moduleProgramNode)
return false;
Modified: trunk/Source/_javascript_Core/runtime/Executable.cpp (204713 => 204714)
--- trunk/Source/_javascript_Core/runtime/Executable.cpp 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/runtime/Executable.cpp 2016-08-22 14:12:10 UTC (rev 204714)
@@ -568,8 +568,8 @@
VM* vm = &exec->vm();
JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject();
std::unique_ptr<ProgramNode> programNode = parse<ProgramNode>(
- vm, m_source, Identifier(), JSParserBuiltinMode::NotBuiltin,
- JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, error);
+ vm, m_source, Identifier(), JSParserBuiltinMode::NotBuiltin,
+ JSParserStrictMode::NotStrict, JSParserCommentMode::Classic, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, error);
if (programNode)
return 0;
ASSERT(error.isValid());
Modified: trunk/Source/_javascript_Core/runtime/Executable.h (204713 => 204714)
--- trunk/Source/_javascript_Core/runtime/Executable.h 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/runtime/Executable.h 2016-08-22 14:12:10 UTC (rev 204714)
@@ -446,7 +446,7 @@
DECLARE_INFO;
- ExecutableInfo executableInfo() const { return ExecutableInfo(usesEval(), isStrictMode(), false, false, ConstructorKind::None, SuperBinding::NotNeeded, SourceParseMode::ProgramMode, derivedContextType(), isArrowFunctionContext(), false, evalContextType()); }
+ ExecutableInfo executableInfo() const { return ExecutableInfo(usesEval(), isStrictMode(), false, false, ConstructorKind::None, JSParserCommentMode::Classic, SuperBinding::NotNeeded, SourceParseMode::ProgramMode, derivedContextType(), isArrowFunctionContext(), false, evalContextType()); }
unsigned numVariables() { return m_unlinkedEvalCodeBlock->numVariables(); }
unsigned numberOfFunctionDecls() { return m_unlinkedEvalCodeBlock->numberOfFunctionDecls(); }
@@ -500,7 +500,7 @@
DECLARE_INFO;
- ExecutableInfo executableInfo() const { return ExecutableInfo(usesEval(), isStrictMode(), false, false, ConstructorKind::None, SuperBinding::NotNeeded, SourceParseMode::ProgramMode, derivedContextType(), isArrowFunctionContext(), false, EvalContextType::None); }
+ ExecutableInfo executableInfo() const { return ExecutableInfo(usesEval(), isStrictMode(), false, false, ConstructorKind::None, JSParserCommentMode::Classic, SuperBinding::NotNeeded, SourceParseMode::ProgramMode, derivedContextType(), isArrowFunctionContext(), false, EvalContextType::None); }
private:
friend class ExecutableBase;
@@ -541,7 +541,7 @@
DECLARE_INFO;
- ExecutableInfo executableInfo() const { return ExecutableInfo(usesEval(), isStrictMode(), false, false, ConstructorKind::None, SuperBinding::NotNeeded, SourceParseMode::ModuleEvaluateMode, derivedContextType(), isArrowFunctionContext(), false, EvalContextType::None); }
+ ExecutableInfo executableInfo() const { return ExecutableInfo(usesEval(), isStrictMode(), false, false, ConstructorKind::None, JSParserCommentMode::Module, SuperBinding::NotNeeded, SourceParseMode::ModuleEvaluateMode, derivedContextType(), isArrowFunctionContext(), false, EvalContextType::None); }
UnlinkedModuleProgramCodeBlock* unlinkedModuleProgramCodeBlock() { return m_unlinkedModuleProgramCodeBlock.get(); }
@@ -661,6 +661,7 @@
const Identifier& inferredName() { return m_unlinkedExecutable->inferredName(); }
size_t parameterCount() const { return m_unlinkedExecutable->parameterCount(); } // Excluding 'this'!
SourceParseMode parseMode() const { return m_unlinkedExecutable->parseMode(); }
+ JSParserCommentMode commentMode() const { return m_unlinkedExecutable->commentMode(); }
const SourceCode& classSource() const { return m_unlinkedExecutable->classSource(); }
static void visitChildren(JSCell*, SlotVisitor&);
Modified: trunk/Source/_javascript_Core/runtime/ModuleLoaderPrototype.cpp (204713 => 204714)
--- trunk/Source/_javascript_Core/runtime/ModuleLoaderPrototype.cpp 2016-08-22 13:51:54 UTC (rev 204713)
+++ trunk/Source/_javascript_Core/runtime/ModuleLoaderPrototype.cpp 2016-08-22 14:12:10 UTC (rev 204714)
@@ -124,7 +124,7 @@
ParserError error;
std::unique_ptr<ModuleProgramNode> moduleProgramNode = parse<ModuleProgramNode>(
&vm, sourceCode, Identifier(), JSParserBuiltinMode::NotBuiltin,
- JSParserStrictMode::Strict, SourceParseMode::ModuleAnalyzeMode, SuperBinding::NotNeeded, error);
+ JSParserStrictMode::Strict, JSParserCommentMode::Module, SourceParseMode::ModuleAnalyzeMode, SuperBinding::NotNeeded, error);
if (error.isValid()) {
throwVMError(exec, error.toErrorObject(exec->lexicalGlobalObject(), sourceCode));