WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
193869
[BigInt] Support constant fold of BigInts on DFG
https://bugs.webkit.org/show_bug.cgi?id=193869
Summary
[BigInt] Support constant fold of BigInts on DFG
Caio Lima
Reported
2019-01-26 10:14:01 PST
...
Attachments
WIP - Patch
(16.90 KB, patch)
2019-01-26 10:33 PST
,
Caio Lima
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Caio Lima
Comment 1
2019-01-26 10:28:14 PST
What I have in mind to make it possible is to follow what we do with Strings right now. The idea is to use LazyJSValue, since we can only allocate heap objects after compilation is finished. In the case of LazyJaValues of BigInts, the plan is to record following information: 1. lhs and rhs operands; 2. Type of operation; To have a robust implementation and fold constants properly, lhs and rhs should be LazyJSValues that also can be computed on further steps. We need to change JSBigInt API to support arithmetic operations that can't fail due OOM. Also, we need to guarantee when constant fold happens that we won't overflow BigInt::maxSize.
Caio Lima
Comment 2
2019-01-26 10:33:08 PST
Created
attachment 360242
[details]
WIP - Patch Here is a very simple version to illustrate what I have in mind now. I'm creating LazyBigIntValue to store required information to calculate BigInts properly. A LazyJSValue(NewBigInt) can have KnowValue or other LazyBigIntValue as operands. This enables us fold cascaded constants. The Folding is being done during Strengthreduction, following String rules as well.
Caio Lima
Comment 3
2019-01-28 05:27:03 PST
(In reply to Caio Lima from
comment #1
)
> What I have in mind to make it possible is to follow what we do with Strings > right now. The idea is to use LazyJSValue, since we can only allocate heap > objects after compilation is finished. In the case of LazyJaValues of > BigInts, the plan is to record following information: > > 1. lhs and rhs operands; > 2. Type of operation; > > To have a robust implementation and fold constants properly, lhs and rhs > should be LazyJSValues that also can be computed on further steps. > We need to change JSBigInt API to support arithmetic operations that can't > fail due OOM. > Also, we need to guarantee when constant fold happens that we won't overflow > BigInt::maxSize.
I think we also can have a special case when BigInts are proven to be 64-bit.
Saam Barati
Comment 4
2019-01-31 00:04:22 PST
Sounds good to me
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug