Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5a241c1e2822e6ad1b32aca9db53babb28e0b375
      
https://github.com/WebKit/WebKit/commit/5a241c1e2822e6ad1b32aca9db53babb28e0b375
  Author: Keith Miller <keith_mil...@apple.com>
  Date:   2024-02-07 (Wed, 07 Feb 2024)

  Changed paths:
    A JSTests/stress/destructuring-class-in-constructor-exception.js
    M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
    M Source/JavaScriptCore/parser/ASTBuilder.h
    M Source/JavaScriptCore/parser/Parser.cpp
    M Source/JavaScriptCore/parser/ParserTokens.h
    M Source/JavaScriptCore/parser/SyntaxChecker.h

  Log Message:
  -----------
  Destructuring exception shouldn't crash
https://bugs.webkit.org/show_bug.cgi?id=268849
rdar://121869296

Reviewed by Yusuke Suzuki.

We recently changed how we saved expression info for exceptions, which saved a 
bunch of memory.
The new system exposed some places where we were not setting JSTextPositions 
properly. This
patch fixes that and adds some asserts that the expression info is initialized. 
We also now
return early rather than emit bad expression info if not all parts are 
initialized in production.
This means users will see the wrong expression in their stack trace but we 
won't crash.

* JSTests/stress/destructuring-class-in-constructor-exception.js: Added.
(try.C0):
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::emitExpressionInfo):
* Source/JavaScriptCore/parser/ASTBuilder.h:
(JSC::ASTBuilder::finishObjectPattern):
(JSC::ASTBuilder::setExceptionLocation):
* Source/JavaScriptCore/parser/Parser.cpp:
(JSC::Parser<LexerType>::parseDestructuringPattern):
(JSC::Parser<LexerType>::parseForStatement):
* Source/JavaScriptCore/parser/ParserTokens.h:
(JSC::JSTextPosition::operator bool const):
* Source/JavaScriptCore/parser/SyntaxChecker.h:
(JSC::SyntaxChecker::operatorStackPop):

Canonical link: https://commits.webkit.org/274213@main


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to