Bug 190800 - [JSC] Implement BigInt64Array and BigUint64Array
Summary: [JSC] Implement BigInt64Array and BigUint64Array
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks: 179001
  Show dependency treegraph
 
Reported: 2018-10-22 11:52 PDT by Caio Lima
Modified: 2021-02-01 12:57 PST (History)
21 users (show)

See Also:


Attachments
Patch (136.00 KB, patch)
2021-01-30 00:35 PST, Yusuke Suzuki
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (136.18 KB, patch)
2021-01-30 00:44 PST, Yusuke Suzuki
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (138.70 KB, patch)
2021-01-30 01:01 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (142.71 KB, patch)
2021-01-30 01:47 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (145.23 KB, patch)
2021-01-30 02:29 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (165.35 KB, patch)
2021-01-31 00:35 PST, Yusuke Suzuki
ross.kirsling: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Caio Lima 2018-10-22 11:52:08 PDT
...
Comment 1 Yusuke Suzuki 2020-05-05 03:46:26 PDT
Because we need to view contiguous int64_t* / uint64_t* memory region via this view, the storage should be just byte sequence. And [] access should wrap the result with JSBigInt when it is accessed from JS world.
Comment 2 lars.sonchocky-helldorf 2020-05-15 13:56:53 PDT
This would be nice to have for that: https://github.com/takahirox/riscv-rust/issues/115
Comment 3 Hao Li 2020-06-17 22:47:59 PDT
We also have the requirement for BigUint64Array in WebGPU: https://github.com/gpuweb/gpuweb/issues/866
Comment 4 johann.hemmann 2020-06-19 06:57:25 PDT
Generally it would be helpful for all projects using wasm_bindgen (https://github.com/rustwasm/wasm-bindgen), so also for the jsapi of the rav1e (https://github.com/xiph/rav1e/tree/master/rav1e_js).
Comment 5 Slim Lim 2020-12-03 23:40:38 PST
Echoing the previous comment, lack of BigUint64Array support means that applications using wasm-bindgen cannot run at all in Safari. This is especially problematic for targeting the iPad.
Comment 6 Yusuke Suzuki 2021-01-30 00:35:08 PST
Created attachment 418810 [details]
Patch
Comment 7 Yusuke Suzuki 2021-01-30 00:44:23 PST
Created attachment 418811 [details]
Patch
Comment 8 Yusuke Suzuki 2021-01-30 01:01:36 PST
Created attachment 418812 [details]
Patch
Comment 9 Yusuke Suzuki 2021-01-30 01:47:10 PST
Created attachment 418813 [details]
Patch
Comment 10 Yusuke Suzuki 2021-01-30 02:29:08 PST
Created attachment 418814 [details]
Patch
Comment 11 Yusuke Suzuki 2021-01-31 00:35:41 PST
Created attachment 418821 [details]
Patch
Comment 12 Ross Kirsling 2021-02-01 11:22:35 PST
Comment on attachment 418821 [details]
Patch

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

r=me, this is awesome!

> Source/JavaScriptCore/runtime/AtomicsObject.h:65
> +JSArrayBufferView* validateTypedArray(JSGlobalObject*, JSValue);

This seems kind of weird? AtomicsObject.cpp needs to include JSArrayBufferView.h anyway, doesn't it?

> Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h:98
> +    using Adaptor = PassedAdaptor;

What's the purpose of this alias?

> Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h:462
> +    if constexpr (Adaptor::canConvertToJSQuickly)

Cool!

> JSTests/test262/expectations.yaml:831
> +test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js:
> +  default: 'TypeError: Invalid argument type in ToBigInt operation (Testing with BigInt64Array.)'
> +  strict mode: 'TypeError: Invalid argument type in ToBigInt operation (Testing with BigInt64Array.)'
> +test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-may-detach-buffer.js:
> +  default: 'Test262Error: throws a TypeError getting a value from the detached buffer Expected a TypeError to be thrown but no exception was thrown at all (Testing with BigInt64Array.)'
> +  strict mode: 'Test262Error: throws a TypeError getting a value from the detached buffer Expected a TypeError to be thrown but no exception was thrown at all (Testing with BigInt64Array.)'

Do you want to submit the patch for these or would you prefer that I do it?
Comment 13 Yusuke Suzuki 2021-02-01 12:44:29 PST
Comment on attachment 418821 [details]
Patch

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

>> Source/JavaScriptCore/runtime/AtomicsObject.h:65
>> +JSArrayBufferView* validateTypedArray(JSGlobalObject*, JSValue);
> 
> This seems kind of weird? AtomicsObject.cpp needs to include JSArrayBufferView.h anyway, doesn't it?

Right! I'll remove it.

>> Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h:98
>> +    using Adaptor = PassedAdaptor;
> 
> What's the purpose of this alias?

Because we would like to access ViewClass::Adaptor.

>> JSTests/test262/expectations.yaml:831
>> +  strict mode: 'Test262Error: throws a TypeError getting a value from the detached buffer Expected a TypeError to be thrown but no exception was thrown at all (Testing with BigInt64Array.)'
> 
> Do you want to submit the patch for these or would you prefer that I do it?

I'll quickly do that after landing this patch :)
Comment 14 Yusuke Suzuki 2021-02-01 12:56:58 PST
Committed r272170: <https://trac.webkit.org/changeset/272170>
Comment 15 Radar WebKit Bug Importer 2021-02-01 12:57:20 PST
<rdar://problem/73842238>