RESOLVED FIXED 180970
[JSC] Do not check isValid() in op_new_regexp
https://bugs.webkit.org/show_bug.cgi?id=180970
Summary [JSC] Do not check isValid() in op_new_regexp
Yusuke Suzuki
Reported 2017-12-19 03:36:08 PST
If we have an invalid regexp, we should emit op_throw_xxx bytecode instead of op_new_regexp.
Attachments
Patch (8.50 KB, patch)
2017-12-19 12:11 PST, Yusuke Suzuki
saam: review+
Yusuke Suzuki
Comment 1 2017-12-19 12:11:18 PST
Saam Barati
Comment 2 2017-12-20 13:37:25 PST
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
Yusuke Suzuki
Comment 3 2017-12-20 17:55:01 PST
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.
Yusuke Suzuki
Comment 4 2017-12-20 17:58:34 PST
Radar WebKit Bug Importer
Comment 5 2017-12-20 18:00:37 PST
Note You need to log in before you can comment on or make changes to this bug.