Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: d8aca95c28f69862452c6d9c8a92e169a337c3e5 https://github.com/WebKit/WebKit/commit/d8aca95c28f69862452c6d9c8a92e169a337c3e5 Author: Alexey Shvayka <ashva...@apple.com> Date: 2024-02-22 (Thu, 22 Feb 2024)
Changed paths: M Source/JavaScriptCore/API/JSScriptRef.cpp M Source/JavaScriptCore/builtins/BuiltinExecutables.cpp M Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp M Source/JavaScriptCore/debugger/DebuggerParseData.cpp M Source/JavaScriptCore/parser/Parser.cpp M Source/JavaScriptCore/parser/Parser.h M Source/JavaScriptCore/runtime/CodeCache.cpp M Source/JavaScriptCore/runtime/Completion.cpp M Source/JavaScriptCore/runtime/JSModuleLoader.cpp Log Message: ----------- [JSC] Set correct ConstructorKind when reparsing functions https://bugs.webkit.org/show_bug.cgi?id=269869 <rdar://problem/123401267> Reviewed by Justin Michaud. Before this change, when reparsing a function, ConstructorKind was always set to None, which prevents a parser-level workaround to fix https://webkit.org/b/268411. Also, ConstructorKind was abused to allow super() in eval(): please see Parser constructor. However, passing down ConstructorKind to parser isn't trivial as it would conflict with `defaultConstructorKindForTopLevelFunction` that is needed only for bytecode validation. To avoid using one parameter for two purposes, this patch extracts parseRootNode(), which has parameters special for debugger / bytecode validation while lacking ones needed only for functions. overrideConstructorKindForTopLevelFunctionExpressions() is introduced for the same purpose. Also, this change: * passes correct DerivedContextType for eval() and reimplements SyntaxError check for super(), all to avoid setting ConstructorKind for non-functions; * hoists ConstructorKind override for bytecode validation up to parseFunctionExpression() to limit the surface of this bytecode validation only hack; * removes unused ParsingContext::Eval. No new tests, no behavior change. * Source/JavaScriptCore/API/JSScriptRef.cpp: (parseScript): * Source/JavaScriptCore/builtins/BuiltinExecutables.cpp: (JSC::BuiltinExecutables::createExecutable): * Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp: (JSC::generateUnlinkedFunctionCodeBlock): * Source/JavaScriptCore/debugger/DebuggerParseData.cpp: (JSC::gatherDebuggerParseData): * Source/JavaScriptCore/parser/Parser.cpp: (JSC::Parser<LexerType>::Parser): (JSC::Parser<LexerType>::parseFunctionInfo): (JSC::Parser<LexerType>::parseFunctionExpression): (JSC::Parser<LexerType>::parseMemberExpression): * Source/JavaScriptCore/parser/Parser.h: (JSC::Scope::setDerivedContextType): (JSC::Scope::derivedContextType const): (JSC::Parser::overrideConstructorKindForTopLevelFunctionExpressions): (JSC::parse): (JSC::parseRootNode): * Source/JavaScriptCore/runtime/CodeCache.cpp: (JSC::generateUnlinkedCodeBlockImpl): * Source/JavaScriptCore/runtime/Completion.cpp: (JSC::checkSyntaxInternal): (JSC::checkModuleSyntax): * Source/JavaScriptCore/runtime/JSModuleLoader.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): Canonical link: https://commits.webkit.org/275189@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes