Bug 192615 - [BigInt] Simplify boolean context evaluation by leveraging JSString::offsetOfLength() == JSBigInt::offsetOfLength()
Summary: [BigInt] Simplify boolean context evaluation by leveraging JSString::offsetOf...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-12-11 22:22 PST by Yusuke Suzuki
Modified: 2018-12-12 00:39 PST (History)
6 users (show)

See Also:


Attachments
Patch (12.18 KB, patch)
2018-12-11 22:24 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (12.68 KB, patch)
2018-12-11 22:26 PST, Yusuke Suzuki
saam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2018-12-11 22:22:36 PST
[BigInt] Simplify boolean context evaluation by leveraging JSString::offsetOfLength() == JSBigInt::offsetOfLength()
Comment 1 Yusuke Suzuki 2018-12-11 22:24:43 PST
Created attachment 357105 [details]
Patch
Comment 2 Yusuke Suzuki 2018-12-11 22:26:07 PST
Created attachment 357106 [details]
Patch
Comment 3 EWS Watchlist 2018-12-11 22:29:39 PST
Attachment 357106 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.h:180:  JSBigInt_length is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
Total errors found: 1 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Saam Barati 2018-12-12 00:21:25 PST
Comment on attachment 357106 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=357106&action=review

> Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.cpp:64
> +    , JSBigInt_length(JSString_length)

Can we add a new field called something like JSBigIntOrString_length then when we load from this in that scenario we can use that field?
Comment 5 Saam Barati 2018-12-12 00:22:05 PST
Comment on attachment 357106 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=357106&action=review

> Source/JavaScriptCore/jit/AssemblyHelpers.cpp:799
> +    ASSERT(JSString::offsetOfLength() == JSBigInt::offsetOfLength());

Let’s do RELEASE_ASSERT. LLVM will remove this branch anyways
Comment 6 Yusuke Suzuki 2018-12-12 00:28:18 PST
Comment on attachment 357106 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=357106&action=review

Thank you!

>> Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.cpp:64
>> +    , JSBigInt_length(JSString_length)
> 
> Can we add a new field called something like JSBigIntOrString_length then when we load from this in that scenario we can use that field?

Sounds nice. Fixed.

>> Source/JavaScriptCore/jit/AssemblyHelpers.cpp:799
>> +    ASSERT(JSString::offsetOfLength() == JSBigInt::offsetOfLength());
> 
> Let’s do RELEASE_ASSERT. LLVM will remove this branch anyways

OK, changed :)
Comment 7 Yusuke Suzuki 2018-12-12 00:35:10 PST
Comment on attachment 357106 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=357106&action=review

>>> Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.cpp:64
>>> +    , JSBigInt_length(JSString_length)
>> 
>> Can we add a new field called something like JSBigIntOrString_length then when we load from this in that scenario we can use that field?
> 
> Sounds nice. Fixed.

I added JSBigIntOrString_length field, and make JSString_length and JSBigInt_length as references& to this abstract heap.
Comment 8 Yusuke Suzuki 2018-12-12 00:38:50 PST
Committed r239099: <https://trac.webkit.org/changeset/239099>
Comment 9 Radar WebKit Bug Importer 2018-12-12 00:39:48 PST
<rdar://problem/46654988>