RESOLVED FIXED Bug 184952
fromCharCode is missing some exception checks
https://bugs.webkit.org/show_bug.cgi?id=184952
Summary fromCharCode is missing some exception checks
Keith Miller
Reported 2018-04-24 19:52:18 PDT
fromCharCode is missing some exception checks
Attachments
Patch (3.67 KB, patch)
2018-04-24 19:55 PDT, Keith Miller
saam: review+
Keith Miller
Comment 1 2018-04-24 19:55:36 PDT
Saam Barati
Comment 2 2018-04-24 20:09:13 PDT
Comment on attachment 338699 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=338699&action=review > JSTests/stress/fromCharCode-exception-check.js:5 > +} catch (e) { } probably worth checking the exception type here
Keith Miller
Comment 3 2018-04-24 20:12:43 PDT
Keith Miller
Comment 4 2018-04-24 20:13:51 PDT
Comment on attachment 338699 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=338699&action=review >> JSTests/stress/fromCharCode-exception-check.js:5 >> +} catch (e) { } > > probably worth checking the exception type here Done.
Keith Miller
Comment 5 2018-04-24 20:14:29 PDT
Darin Adler
Comment 6 2018-04-26 21:07:41 PDT
Comment on attachment 338699 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=338699&action=review > Source/JavaScriptCore/runtime/StringConstructor.cpp:82 > + RETURN_IF_EXCEPTION(scope, encodedJSValue()); > + scope.release(); Sad to have to do this branch just to optimize the exception case. Can’t this have the optimization that the old code did, where it just did a little wasteful work to make the single character string that would then be ignored, and let the exception propagate without checking for it explicitly? Or is that impractical now?
Keith Miller
Comment 7 2018-04-27 10:10:31 PDT
Comment on attachment 338699 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=338699&action=review >> Source/JavaScriptCore/runtime/StringConstructor.cpp:82 >> + scope.release(); > > Sad to have to do this branch just to optimize the exception case. Can’t this have the optimization that the old code did, where it just did a little wasteful work to make the single character string that would then be ignored, and let the exception propagate without checking for it explicitly? Or is that impractical now? We could do that. You'd just need to move the scope.release() above the current line. In practice though, I'd guess that the branch doesn't actually matter much, especially if it's never taken. By the time we get to the DFG/FTL, we already have an intrinsic for fromCharCode so this code doesn't really matter. In the LLInt/Baseline there are so many other branches this one probably doesn't matter. Either way, since it's safe to just ignore the exception status I'll remove the RETURN_IF_EXCEPTION line.
Keith Miller
Comment 8 2018-04-27 11:33:51 PDT
(In reply to Keith Miller from comment #7) > Comment on attachment 338699 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=338699&action=review > > >> Source/JavaScriptCore/runtime/StringConstructor.cpp:82 > >> + scope.release(); > > > > Sad to have to do this branch just to optimize the exception case. Can’t this have the optimization that the old code did, where it just did a little wasteful work to make the single character string that would then be ignored, and let the exception propagate without checking for it explicitly? Or is that impractical now? > > We could do that. You'd just need to move the scope.release() above the > current line. > > In practice though, I'd guess that the branch doesn't actually matter much, > especially if it's never taken. By the time we get to the DFG/FTL, we > already have an intrinsic for fromCharCode so this code doesn't really > matter. In the LLInt/Baseline there are so many other branches this one > probably doesn't matter. > > Either way, since it's safe to just ignore the exception status I'll remove > the RETURN_IF_EXCEPTION line. Uploaded: https://bugs.webkit.org/show_bug.cgi?id=185083
Note You need to log in before you can comment on or make changes to this bug.