If we have an invalid regexp, we should emit op_throw_xxx bytecode instead of op_new_regexp.
Created attachment 329788 [details] Patch
Comment on attachment 329788 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=329788&action=review r=me with debug build fix. > Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:149 > + const Identifier& message = generator.parserArena().identifierArena().makeIdentifier(generator.vm(), bitwise_cast<const LChar*>(messageCharacters), strlen(messageCharacters)); bitwise_case -> static_cast? > JSTests/stress/regexp-syntax-error-invalid-flags.js:18 > + return /Hello/cocoa; I vote for adding a few more invalid regrex tests
Comment on attachment 329788 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=329788&action=review Thank you! >> Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:149 >> + const Identifier& message = generator.parserArena().identifierArena().makeIdentifier(generator.vm(), bitwise_cast<const LChar*>(messageCharacters), strlen(messageCharacters)); > > bitwise_case -> static_cast? Since this is `const char*` to `const LChar*` cast, bitwise_cast is necessary. (LChar is uint8_t). >> JSTests/stress/regexp-syntax-error-invalid-flags.js:18 >> + return /Hello/cocoa; > > I vote for adding a few more invalid regrex tests The other invalid RegExp becomes early (parser phase) syntax error. We have relaxed rule for invalid flags, which raise runtime errors.
Committed r226209: <https://trac.webkit.org/changeset/226209>
<rdar://problem/36169188>