RESOLVED FIXED 205416
Teach the bytecode that arithmetic operations can return bigints
https://bugs.webkit.org/show_bug.cgi?id=205416
Summary Teach the bytecode that arithmetic operations can return bigints
Robin Morisset
Reported 2019-12-18 14:40:29 PST
Attachments
Patch (6.37 KB, patch)
2019-12-18 15:07 PST, Robin Morisset
ysuzuki: review+
rmorisset: commit-queue-
Patch (6.78 KB, patch)
2020-01-15 13:05 PST, Robin Morisset
no flags
Patch (7.17 KB, patch)
2020-01-16 15:10 PST, Robin Morisset
no flags
Robin Morisset
Comment 1 2019-12-18 15:07:20 PST
Yusuke Suzuki
Comment 2 2019-12-18 15:41:52 PST
Comment on attachment 386013 [details] Patch r=me
Mark Lam
Comment 3 2019-12-18 15:46:12 PST
Comment on attachment 386013 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=386013&action=review > Source/JavaScriptCore/parser/ResultType.h:182 > + return ResultType(TypeMaybeBigInt | TypeMaybeNumber); Can you add a bigIntOrNumberType() constexpr function (like the ones above) for this and use that here? > Source/JavaScriptCore/parser/ResultType.h:191 > + return ResultType(TypeMaybeBigInt | TypeMaybeNumber); Ditto.
Robin Morisset
Comment 4 2019-12-18 16:05:24 PST
Comment on attachment 386013 [details] Patch cq- until I apply Mark's suggestion
Robin Morisset
Comment 5 2020-01-15 13:05:29 PST
Created attachment 387829 [details] Patch Rebased + applied Mark's comment.
Caio Lima
Comment 6 2020-01-15 13:20:55 PST
Comment on attachment 387829 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=387829&action=review > JSTests/stress/big-int-arithmetic-return-big-int.js:5 > + return (1n*1n) / 1; I think it would be good include other operations as well here. > Source/JavaScriptCore/ChangeLog:8 > + Add already has the correct ResultType, but previously Sub/Mult/Div/Mod/Pow/Negate were always claimed to return Number, and when BigInt is enabled they can also return BigInt. nit: I think we need to wrap line > Source/JavaScriptCore/parser/NodeConstructors.h:505 > + // UnaryPlus is guaranteed to always return a number, never a BigInt. It would be good add a link to spec here. (https://tc39.es/ecma262/#sec-unary-plus-operator-runtime-semantics-evaluation)
Robin Morisset
Comment 7 2020-01-16 15:09:43 PST
Thanks for the comments. (In reply to Caio Lima from comment #6) > Comment on attachment 387829 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=387829&action=review > > > JSTests/stress/big-int-arithmetic-return-big-int.js:5 > > + return (1n*1n) / 1; Done. > I think it would be good include other operations as well here. > > > Source/JavaScriptCore/ChangeLog:8 > > + Add already has the correct ResultType, but previously Sub/Mult/Div/Mod/Pow/Negate were always claimed to return Number, and when BigInt is enabled they can also return BigInt. > > nit: I think we need to wrap line Done. > > Source/JavaScriptCore/parser/NodeConstructors.h:505 > > + // UnaryPlus is guaranteed to always return a number, never a BigInt. > > It would be good add a link to spec here. > (https://tc39.es/ecma262/#sec-unary-plus-operator-runtime-semantics- > evaluation) Done.
Robin Morisset
Comment 8 2020-01-16 15:10:20 PST
WebKit Commit Bot
Comment 9 2020-01-16 15:53:24 PST
Comment on attachment 387967 [details] Patch Clearing flags on attachment: 387967 Committed r254716: <https://trac.webkit.org/changeset/254716>
WebKit Commit Bot
Comment 10 2020-01-16 15:53:26 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 11 2020-01-16 15:54:20 PST
Note You need to log in before you can comment on or make changes to this bug.